note 76642 deleted from language.operators.increment by nlopess
| From: | nlopess@php.net | Date: | Tue, 24 Jul 2007 19:33:51 +0000 |
| Subject: | note 76642 deleted from language.operators.increment by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-128889@lists.php.net to get a copy of this message | ||
Note Submitter: my name
----
Using the ternary operator with an increment didn't work as expected.
<?php
$counter = $counter >= $total ? $total : $counter++;
// $counter doesn't increment even when < $total
$counter = $counter >= $total ? $total : $counter+1;
// $counter increments when < $total
?>