note 97985 modified in function.current by danbrown
| From: | danbrown@php.net | Date: | Fri, 10 Sep 2010 14:53:47 +0000 |
| Subject: | note 97985 modified in function.current by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172444@lists.php.net to get a copy of this message | ||
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!
--was--
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:
//get the first element of the returned array
$element = current(get_my_arrays());
http://php.net/manual/en/function.current.php