Latest Tutorials

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     $...

Example with bitwise operators

<?php     $a & $b; // (AND) Bits set in both variables will be stored as the result     $a | $b; // (OR) Bits set in either variable will be stored as th...

Example of error operator in PHP

<?php $my_new_file = @file('fake_file') or die (&qu...

Example of execution operator in PHP

<?php $output_shell = "ls -al"; echo $output_shell; ?...

Example of increment and decrement operators in PHP

<?php     $a = 10;     ++$a; // Pre-Increment; will increase $a by one and return 11     $a++; // Post-Increment; returns $a and then increas...

Example of logical operators in PHP

<?php     $a = (false && func());  // AND operator     $a = (true || func());   // OR operator     $a = (false and func());...

Example of string operators in PHP

<?php     $a = "This is ";       $b = $a . "PHP tutorial"; // The output is 'This is PHP tutorial'     $a .=...

Example of array operators in PHP

<?php     $a + $b; // (Union) Union of variables $a and $b     $a == $b; // (Equality) True if $a and $b have same key/value pairs     ...

Example of type operator (instanceof) in PHP

<?php class MyClass { // ... } class YourClass {...

Example of IF - ELSE statement

<?php $a = 3; $b = 1; if ($a > $b) { echo "...