PHP tutorial examples

Basic concept: Basic PHP syntax example

Basic PHP syntax example

<?php     $k = 6+5;     echo $k; // correct     Echo $k; // correct          // Comment exa...

PHP constants definition example

<?php          define("CONSTANT", "Hello");          echo CONSTANT; // Output is 'Hello'...

PHP variables definition example

<?php     // declaring variables     $x = 7;     $y = 2;           function ADD()     {

Basic example of PHP echo and print statements

<?php     echo "Hello world <br />";     echo "Multiple ", "parameters ", "can be ", "used."; &...

Example of a Boolean data type in PHP

<?php echo "<style>p{font-size:smaller;}</style>"...

Example of a PHP conversion to an integer

<?php echo "<style>p{font-size:smaller;}</style>"...

Example of a floating point data type

<?php echo "<style>p{font-size:smaller;}</style>"...

Simple example of an array data type

<?php     $array = array(         "fruit1" => "apple",         "fruit2" => "peac...

Example of assignment operators

<?php     $a = 3;     // assigns value of 3 to variable $a     $a = ($b = 4) + 5;  //$a equals to 9 while $b is set to 4     $...