note 94213 deleted from function.end by danbrown
| From: | danbrown@php.net | Date: | Tue, 30 Mar 2010 14:13:55 +0000 |
| Subject: | note 94213 deleted from function.end by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-167528@lists.php.net to get a copy of this message | ||
Note Submitter: y dot vecchi at gmail dot com
----
to see if foreach is in last element of array in PHP5 you can use the end() function...
<?php
$test = array( 5, 4, 3, 2, 1 );
foreach($test as $value)
{
if (end($test) == $value)
{
echo "I'm the last";
}
}
?>