Let me try that again with the files attached. I'll leave out the full original proposal this time.


On Sep 10, 2007, at 6:12 PM, Andrew Shearer wrote:

Here's a patch against HEAD that implements the array_get function previously suggested on this list. I also attached a test suite, which should go in ext/standard/tests/array/array_get.phpt. Feedback is welcome.

Independently, someone else had posted the same idea as a feature request for PHP 5, and if there's interest I can backport it.

40792 Open Wish: Function array_get(&$mixed, $key, $defaultvalue)

/* Prototype:
*  mixed array_get ( array $search, mixed $key, mixed $default );
* Description:
*  Returns the value corresponding to the given key if the key exists
*  in the array. $key can be any value possible for an array index.
*  If the key does not exist, the function returns $default, or FALSE
*  if $default is not specified. Also works on objects.
*  Similar semantics to array_key_exists.
*/

Here is the original proposal:
...

--
Andrew Shearer
http://ashearer.com/


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to