<?php
$x = 24;
$y = 3;
echo $x + $y . " this is addition <br>";
echo $x - $y . " this is subtraction <br>";
echo $x * $y . " this is multiplication <br>";
echo $x / $y . " this is division <br>";
echo $x % $y . " this is modulus <br>";
echo $x ** $y . " this is exponentation <br>";
echo $x = $y . " this is the same as x = y <br>";
echo $x += $y . " this is the same as x = x + y <br>";
echo $x -= $y . " this is the same as x = x - y <br>";
echo $x *= $y . " this is the same as x = x * y <br>";
echo $x /= $y . " this is the same as x = x / y <br>";
echo $x %= $y . " this is the same as x = x % y <br>";
echo $x == $y . " this returns true if x is equal to y <br>";
echo $x === $y . " this returns true if x is equal to y and they are of the same type <br>";
echo $x != $y . " this returns true if x is not equal to y <br>";
echo $x <> $y . " this also returns true if x is not equal to y <br>";
echo $x !== echo $x = $y . " this returns true if x is not equal to y, or they are not of the same type <br>";
echo $x > $y . " this returns true if x is greater than y <br>";
echo $x < $y . " this returns true if x is less than y <br>";
echo $x >= $y . " this returns true if x is greater than or equal to y <br>";
echo $x <= $y . " this returns true if x is less than or equal to y <br>";
echo $x <=> . " this returns an integer less than, equal to, or greater than zero, depending on if x is less than, equal to, or greater than y. Introduced in PHP 7. <br>";
echo ++$x . " this increments x by 1 and then returns x <br>";
echo $x++ . " this returns x and increments x by 1 <br>";
echo --$x . " this decrements x by 1 and then returns x <br>";
echo $x-- . " this returns x and decrements x by 1 <br>";
$a = $x >= $y
$b = $x <= $y
echo $a and $b . " this returns true if both, a and b are true <br>";
echo $a or $b . " this returns true if either of them (or both) are true <br>";
echo $a xor $b . " this returns true if either of them are true, but not both";
echo $a && $b . " this returns true if both, a and b are true <br>";
echo $a || $b . " this returns true if either of them are true <br>";
echo !$b . " this returns true if b is not true <br>";
$text1 = "Sharp";
$text2 = "Nails";
echo $text1 . $text2 . " this adds text1 before text2 <br>";
echo $text1 .= $text2 . " this appends text2 to text1"
$polygons = array("pentagon","hexagon","heptagon")
$polygons1 = array("octagon","nonagon","decagon")
print_r($polygons+$polygons1);
var_dump($polygons == $polygons1);
var_dump($polygons != $polygons1);
var_dump($polygons <> $polygons1);
var_dump($polygons !== $polygons1);
echo $status = (empty($user)) ? "anonymous" : "logged in";
echo(" when empty(user) is true, status is set to anonymous, when empty(user) is false, status is set to logged in<br>");
$user = "Rick Astley";
echo $status = (empty($user)) ? "anonymous" : "logged in";
echo "<br>"
echo $user = $_get["user"] ?? "anonymous";
echo(" the value of user is _get['user'] if _get['user'] exists, and is not NULL. If _get['user'] does not exist, or is NULL, the value of user is anonymous.<br>");
?>