In this tutorial you will learn about the PHP Syntax and its application with practical example.
PHP’s syntax are similar to most of the other programming languages (C, Java, Perl) with the addition that all PHP code is contained within a tag. PHP code can be easily embed into your HTML code.
Table Of Contents−
Four different ways to escaping to PHP:
1 2 3 4 |
<?php...?> //Canonical PHP tags <?...?> //Short-open (SGML-style) tags <%...%> //ASP-style tags <script language="PHP">...</script> //HTML script tags |
Note:- You can set the escaping option in your php.ini file.
Commenting in PHP Code:
1 2 3 4 5 6 7 8 |
# This is a single line comment // This is a single comment too. /* This is a comment with multiline Test multiline commenting. */ |
PHP Statement termination:
Every statement in PHP must be followed by a semicolon (;). Block of valid PHP statements that is enclosed by the PHP tags is a valid PHP program.
PHP Case sensitivity:
In PHP the user defined functions, classes, core language keywords (for example if, else, while, echo etc.) are case-insensitive. PHP variables are case-sensitive