note 96806 deleted from function.end by danbrown
| From: | danbrown@php.net | Date: | Fri, 19 Mar 2010 15:33:59 +0000 |
| Subject: | note 96806 deleted from function.end by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-167219@lists.php.net to get a copy of this message | ||
Note Submitter: Serge
----
Please note, this is wrong way to check the end of array with end() function, how did some guys.
Here is example:
<?php
$arr = array('a', 'b', 'd', 'c', 'd');
foreach ($arr as $v)
{
if (end($arr) == $v)
{
echo 'End of array', PHP_EOL;
}
}
?>
if case u wanna insert commas between all elements, use implode(',', $arr)