Hi,
Please also add the patch provided by John Bafford last Januari.
Arnold
Andrew Shearer wrote:
I had forgotten that attachments aren't allowed. Here are links to the
patch and test suite.
This ought to work. Sorry for the multiple posts, everyone.
http://ashearer.com/software/array_get/2007-09-10-php6/array_get.diff
http://ashearer.com/software/array_get/2007-09-10-php6/array_get.phpt
On Sep 10, 2007, at 6:27 PM, Andrew Shearer wrote:
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