Introduce with PHP Hello World and Variable
PHP follows a structure to write php code. If we want to write php code then we should write "<?php .......... ?>" . The php code is included in this script of php. If we are using only php code for this file it's not necessary to close "?>" this script.
To print something in php we should write "echo". echo is predefined php function which is features is to print something in php.
<?php
echo "Hello novice developer";
?>
PHP Variable :
Variable is name given to the memory location.It can be changed.
Writing condition of PHP Variable
- In php variable name must be start with a dollar ($) sign
i.e , I want a variable named x then I can write
$x = is write syntax and
x = is wrong syntax
- First charecter must be underscore or letter
i.e, $x , $X and $_x is all are ok .
- Variable name case sensitive
$ABC and $abc is not equal
<?php
$x;
$x = 10;
echo $x;
?>