Skip to content

Instantly share code, notes, and snippets.

@geekcom
Created April 23, 2017 03:22
Show Gist options
  • Save geekcom/9a0179acabed83b595efb3b1ed1809f5 to your computer and use it in GitHub Desktop.
Save geekcom/9a0179acabed83b595efb3b1ed1809f5 to your computer and use it in GitHub Desktop.
<?php
echo "<h3>Pós-incremento</h3>";
$a = 5;
echo "Deve ser 5: " . $a++ . "<br>\n";
echo "Deve ser 6: " . $a . "<br>\n";
echo "<h3>Pré-incremento</h3>";
$a = 5;
echo "Deve ser 6: " . ++$a . "<br>\n";
echo "Deve ser 6: " . $a . "<br>\n";
echo "<h3>Pós-decremento</h3>";
$a = 5;
echo "Deve ser 5: " . $a-- . "<br>\n";
echo "Deve ser 4: " . $a . "<br>\n";
echo "<h3>Pré-decremento</h3>";
$a = 5;
echo "Deve ser 4: " . --$a . "<br>\n";
echo "Deve ser 4: " . $a . "<br>\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment