Ask a Question related to PHP Bugs, Design and Development.
-
m_rayman at bigfoot dot com #1
#23022 [Com]: Supported dereferencing array indeces on arbitrary expressions
ID: 23022
Comment by: m_rayman at bigfoot dot com
Reported By: [email]mfischer@php.net[/email]
Status: Open
Bug Type: Feature/Change Request
Operating System: Any
PHP Version: 5CVS-2003-04-02 (dev)
New Comment:
doesn't fix the bug, but a workaround:
function array_val($array, $key) {
return $array[$key];
}
then you can do things like:
var_dump(array_val(array('a', 'b'), 1));
Previous Comments:
------------------------------------------------------------------------
[2003-04-02 10:30:35] [email]mfischer@php.net[/email]
Supported dereferencing array indeces on arbitrary expressions.
Currently you can only dereference array indeces on variables
directly:
$a = array('a', 'b');
var_dump($a[1]);
but this does not work
var_dump(array('a', 'b')[1]);
neither does this:
function returnArray() {
return array('a', 'b');
}
var_dump(returnArray()[1]);
or this:
$value = ($ns == 'foo' ? $thisArray : $thatArray)[0];
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=23022&edit=1[/url]
m_rayman at bigfoot dot com Guest
-
Dereferencing a 2-dimensional array in plpgsql
I am having an issue with trying to dereference a 2-dimensional array in plpgsql. The idea is to have an setup like: DECLARE myarray varchar;... -
Problem with dereferencing of $_
Hello all, testing the use of DBI. Having a problem (highlighted in red) with using "@$_" as the topic. When I use @row the program writes... -
Probably a dereferencing problem - maybe???
I have some code below that works fine. It finds duplicates on one field and marks them as duplicates. But I'd like to also remove all quotes (")... -
array of regular expressions on a string
Hi, Why don't you do like that : @array = ( '^to: myprog', '^from: ram@hotmail.com' ); $STRING = read_mail_header(...); -
Array dereferencing
Hi; I the code below, I am creating a data structure of array references. I want to loop through the keys, and for each key, which corresponds...



Reply With Quote

