Skip to content

Instantly share code, notes, and snippets.

@flaviors200
Last active May 22, 2019 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flaviors200/f2415a15146449472e7ce7401799459c to your computer and use it in GitHub Desktop.
Save flaviors200/f2415a15146449472e7ce7401799459c to your computer and use it in GitHub Desktop.
Assignment operators
<?php
$x = 30;
echo $x."\n"; // Output: 30
$x += 30;
echo $x."\n"; // Output: 60
$x -= 20;
echo $x."\n"; // Output: 40
$x *= 3;
echo $x."\n"; // Output: 120
$x /= 10;
echo $x."\n"; // Output: 12
$x %= 5;
echo $x."\n"; // Output: 2
$x **= 4;
echo $x."\n"; // Output: 16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment