note 124228 added to function.current
| From: | leozmm at outlook dot com | Date: | Tue, 24 Sep 2019 08:02:51 +0000 |
| Subject: | note 124228 added to function.current | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-212343@lists.php.net to get a copy of this message | ||
Array can be passed by both REFERENCE and EXPRESSION on
current, because current
doesn't move array's internal pointer,
this is not true for other functions like: end, next, prev
etc.
<?php
function foo() {return array(1,2,3);}
echo current(foo()); // this print '1'
echo end(foo()); // this print error: Only variables should be passed by reference
?>
----
Server IP: 208.43.231.9
Probable Submitter: 119.81.81.244 (proxied: 114.247.177.130)
----
Manual Page -- http://php.net/manual/en/function.current.php
Edit -- https://master.php.net/note/edit/124228
Del: integrated -- https://master.php.net/note/delete/124228/integrated
Del: useless -- https://master.php.net/note/delete/124228/useless
Del: bad code -- https://master.php.net/note/delete/124228/bad+code
Del: spam -- https://master.php.net/note/delete/124228/spam
Del: non-english -- https://master.php.net/note/delete/124228/non-english
Del: in docs -- https://master.php.net/note/delete/124228/in+docs
Del: other reasons-- https://master.php.net/note/delete/124228
Reject -- https://master.php.net/note/reject/124228
Search -- https://master.php.net/manage/user-notes.php