note 76642 added to language.operators.increment
| From: | myname at osu1 dot php dot net | Date: | Tue, 24 Jul 2007 11:24:37 +0000 |
| Subject: | note 76642 added to language.operators.increment | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128881@lists.php.net to get a copy of this message | ||
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
?>
----
Server IP: 69.147.83.197
Probable Submitter: 195.229.241.180 (proxied: 217.165.52.173)
----
Manual Page -- http://www.php.net/manual/en/language.operators.increment.php
Edit -- https://master.php.net/note/edit/76642
Del: integrated -- https://master.php.net/note/delete/76642/integrated
Del: useless -- https://master.php.net/note/delete/76642/useless
Del: bad code -- https://master.php.net/note/delete/76642/bad+code
Del: spam -- https://master.php.net/note/delete/76642/spam
Del: non-english -- https://master.php.net/note/delete/76642/non-english
Del: in docs -- https://master.php.net/note/delete/76642/in+docs
Del: other reasons-- https://master.php.net/note/delete/76642
Reject -- https://master.php.net/note/reject/76642
Search -- https://master.php.net/manage/user-notes.php