PHP’s language syntax is similar to that of most programming languages such a C, as PHP was primarily based of the C language. However with PHP you are not required to compile the code and the code you write must be contained within a tag that starts and ends the PHP code.
// Your PHP code goes here
?> // and this closes the PHP block
As PHP code is used in conjunction with HTML this allows for easy transitions in and out of PHP.
There are two different types of comments, a single line comment and a block comment.
// This is a single line comment
/* this comment
can go across
multiple lines */
The first step to learning any language is to print Hello World. In PHP this is very simple and done with one line of code.
echo “Hello World!”;
echo is the basic command for printing text to a page.
Thank you for reading. PHPinformation.org, your home for quality PHP Information.