note 97985 deleted from function.current by googleguy
| From: | googleguy@php.net | Date: | Sat, 12 Jan 2013 09:51:23 +0000 |
| Subject: | note 97985 deleted from function.current by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192974@lists.php.net to get a copy of this message | ||
Note Submitter: marc dot hanisch at nospam dot ateam dot de
----
current() works with functions returning an array, too.
This is helpfull to get the first element of the returned array.
Note that current() with functions always returns the first element, because there is no variable
the array was assigned to (and therefore no pointer).
Example:
<?php
//get the first element of the returned array
$element = current(get_my_arrays());
?>
In addition, current() with functions will not behave as assumed if your function returns an array
reference and modifies the arrays pointer, of course!