16-operators.php
<?php
$x=5;
$y=7;
echo $x+$y;
echo "</br>";
echo $x-$y;
echo "</br>";
echo $x*$y;
echo "</br>";
echo $x/$y;
echo "</br>";
echo $x%$y;
echo "</br>";
echo $x ** $y;
echo "</br>";
// assignemnt oparators
$x=$x+$y;
echo $x;
echo "</br>";
// comparision operators
// we are using this at conditons
// if $x == $y means
// check value and type of both varaibles
// !=
// or <>
// !==
// >
// <
// >=
// <=
// <==>
// space ship
$x = 5;
$y = 10;
echo ($x <=> $y); // returns -1 because $x is less than $y
echo "<br>";
$x = 10;
$y = 10;
echo ($x <=> $y); // returns 0 because values are equal
echo "<br>";
$x = 15;
$y = 10;
echo ($x <=> $y); // returns +1 because $x is greater than $y
?>
==
No comments:
Post a Comment