Can anyone explain why the following code works in php5.6, not working in php5.3?
array_values(array)[key]
or give me some keywords ? I've googled for that but cannot find any answers.
Can anyone explain why the following code works in php5.6, not working in php5.3?
array_values(array)[key]
or give me some keywords ? I've googled for that but cannot find any answers.
That's called Array Dereferencing. Have a look here: http://php.net/manual/en/language.types.array.php#example-102
function getArray() {
return array(1, 2, 3);
}
// on PHP 5.4
$secondElement = getArray()[1];
// previously
$tmp = getArray();
$secondElement = $tmp[1];