Our First PHP Script
A PHP script is executed on the server, and the plain HTML result is sent back to the browser.
1. PHP code is written within the <?php and ?> tags
2. The script can be placed any where in the PHP file
3. Generally saved with '.php' extension
4. Version specific extensions like .phtml, .php4, .php5 are also used.
<?php // code statements ?>
<?php echo "Hi!!! My first script" ?>
PHP Case Sensitivity
<?php //Variable names are case-sensitive $color = "red"; echo "My car is " . $color ; echo "My house is " . $COLOR ; //Keywords are not case-sensitive echo "Hello World!"; EcHo "Hello World!"; ?>
Comment in PHP
<?php # This is also a single line comment // This is a single line comment /* This is also a single line comment another line of comment */ ?>
Syntax Guidelines and Rules