ID: 41268
Updated by: [EMAIL PROTECTED]
Reported By: viktor_b_68 at passagen dot se
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
PHP Version: 5.2.1
New Comment:
This was discussed multiple times before and was rejected. Please check
the archives of php-internals to get further details.
btw. You can easily implement your array_value() function yourself. We
won't add simple array functions.
Previous Comments:
------------------------------------------------------------------------
[2007-05-03 12:06:52] viktor_b_68 at passagen dot se
Description:
------------
When you get a reference to an array, by a function, there is no way to
access any certain member of the array.
With this function given:
<?php
function get_array()
{
return array("foo" => "FOO", "bar" => "BAR");
}
?>
there is no way to do:
<?php print get_array()["foo"] ?>
You have to do like this:
<?php
$array = get_array();
print $array["foo"];
?>
There should be a way to access a member of the array in only one
expression, without the need for assigning a variable.
Either by using the first syntax above, or if you don't like the looks
of it, maybe a function like this:
<?php print array_value(get_array(), "foo") ?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41268&edit=1