Jump to content

[SOLVED] PHP Increment and Decrement


TheFilmGod

Recommended Posts

<?php

$num="2";

?>

 

....

image/<?php echo --$num; ?>

....

image/<?php echo ++$num; ?>

 

Why does the first one end up as 1, and the second image/... ends up as 2. Please tell me how I can reset the variable so that the ++ does not influence the updated variable but the original one.

Link to comment
https://forums.phpfreaks.com/topic/39265-solved-php-increment-and-decrement/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.