note 83430 added to function.end
| From: | sasha1rus at gmail dot com | Date: | Mon, 26 May 2008 06:18:47 +0000 |
| Subject: | note 83430 added to function.end | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139778@lists.php.net to get a copy of this message | ||
Note that this function does not affect foreach loops. For example:
<?php
$a = array(1,2,3,4,5,6);
foreach ($a as $n)
{
echo $n . ' ';
if ($n == end($a))
{
echo 'End!';
}
}
?>
The output would be "1 2 3 4 5 6 End!", not "1 6 End!". Tested using php 5.2.5.
----
Server IP: 69.147.83.197
Probable Submitter: 71.237.230.194
----
Manual Page -- http://www.php.net/manual/en/function.end.php
Edit -- https://master.php.net/note/edit/83430
Del: integrated -- https://master.php.net/note/delete/83430/integrated
Del: useless -- https://master.php.net/note/delete/83430/useless
Del: bad code -- https://master.php.net/note/delete/83430/bad+code
Del: spam -- https://master.php.net/note/delete/83430/spam
Del: non-english -- https://master.php.net/note/delete/83430/non-english
Del: in docs -- https://master.php.net/note/delete/83430/in+docs
Del: other reasons-- https://master.php.net/note/delete/83430
Reject -- https://master.php.net/note/reject/83430
Search -- https://master.php.net/manage/user-notes.php