note 101317 deleted from control-structures.foreach by googleguy
| From: | googleguy@php.net | Date: | Wed, 14 Nov 2012 22:23:10 +0000 |
| Subject: | note 101317 deleted from control-structures.foreach by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191951@lists.php.net to get a copy of this message | ||
Note Submitter: Alex S.
----
Just found a way without a counter handling last element in a foreach :
<?php
$foo = ($current_key == count($array)-1) ? "last element" : "any other element";
?>