Compare pre-increment to post-increment in PHP
Description
The following code shows how to compare pre-increment to post-increment.
Example
<?php/*from w ww . j a v a 2s.c o m*/
$VisitorsToday = 1;
//prints 1
print($VisitorsToday++);
//VisitorsToday is now 2
print("<br>\n");
//prints 3
print(++$VisitorsToday);
print("<br>\n");
//prints 4.14
$pi = 3.14;
$pi++;
print($pi);
print("<br>\n");
//prints PHQ
$php = "PHP";
$php++;
print($php);
print("<br>\n");
//prints PHP
$php = "PHP";
$php--;
print($php);
print("<br>\n");
?>
The code above generates the following result.