note 101317 added to control-structures.foreach
| From: | AlexS dot at osu1 dot php dot net | Date: | Thu, 09 Dec 2010 15:18:09 +0000 |
| Subject: | note 101317 added to control-structures.foreach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174747@lists.php.net to get a copy of this message | ||
Just found a way without a counter handling last element in a foreach :
$foo = ($current_key == count($array)-1) ? "last element" : "any other element";
----
Server IP: 212.124.37.9
Probable Submitter: 88.77.43.245
----
Manual Page -- http://www.php.net/manual/en/control-structures.foreach.php
Edit -- https://master.php.net/note/edit/101317
Del: integrated -- https://master.php.net/note/delete/101317/integrated
Del: useless -- https://master.php.net/note/delete/101317/useless
Del: bad code -- https://master.php.net/note/delete/101317/bad+code
Del: spam -- https://master.php.net/note/delete/101317/spam
Del: non-english -- https://master.php.net/note/delete/101317/non-english
Del: in docs -- https://master.php.net/note/delete/101317/in+docs
Del: other reasons-- https://master.php.net/note/delete/101317
Reject -- https://master.php.net/note/reject/101317
Search -- https://master.php.net/manage/user-notes.php