NYCPHP Meetup

NYPHP.org

[nycphp-talk] Top 5 Most Useful PHP Functions?

Scott Mattocks scott at crisscott.com
Fri Nov 12 09:39:24 EST 2004


David Mintz wrote:

> Indeed, is there any other one-liner in PHP to snag just the 1st element
> of something that returns an array?

reset()
http://us2.php.net/manual/en/function.reset.php

$firstElement = reset(funcThatReturnsArray());

or array_shift() if you want to remove it from the array too
http://us2.php.net/manual/en/function.array-shift.php

-- 
Scott Mattocks
scott at crisscott.com
http://www.crisscott.com
http://pear.php.net/user/scottmattocks



More information about the talk mailing list