PHP stands for Hypertext Preprocessor and is a server-side language. This means that when a visitor opens the page, the server processes the PHP commands and then sends the results to the visitor’s browser, just as with ASP. A typical PHP files will content commands to be executed in the server in addition to the usual mixture of text and HTML (Hypertext Markup Language) tags. However, PHP is Open Source and cross-platform. PHP runs on Windows NT and many Unix versions, and it can be built as an Apache module and as a binary that can run as a CGI.
Common uses of PHP in web development
1) PHP is the server side scripting language, you can use this for creating static and dynamic website.
2) You can restrict your visitor to access some private web pages of your website.
3) You can use for encrypt and decrypt data.
Canonical PHP tags and Short-open (SGML-style) tags
If you are ready to start coding in php, then you can use the opening and closing tags in two manners. Following are the ways by which you can start and end the PHP tags :
1) ( PHP tags )
2) .... ?> ( Short-open tags )
PHP’s language syntax is similar to C’s and Perl’s. You don’t have to declare variables before you use them.
Running PHP Script from Command Prompt
You can run PHP in two different ways first is using web browser like google chrome, Firefox, Internet explorer, Safari, and etc.. and second is using the command line. bellow is the examples that describe how to run PHP from command line.
Create hello.php page and add bellow code snippets and saved it.
echo "My first PHP script!";
Now run bellow command from command line as follows −
$ php hello.php
You will get the output as :
My first PHP script!