Learning PHP and MySQL
Example 03-25 Using pre- and post-increment
<?php
$test=1;
echo "Preincrement: ".(++$test);
echo "<BR>";
echo "Value afterwords: ".$test;
echo "<BR>";
$test=1;
echo "Postincrement: ".($test++);
echo "<BR>";
echo "Value afterwords: ".$test;
?>
Produces:
Preincrement: 2
Value afterwords: 2
Postincrement: 1
Value afterwords: 2
Posted by on 07/19 at 03:59 PM
Next entry: Example 04-01 Sum of values
Previous entry: Example 03-24 Using the autodecrement operator