Is there a way in PHP to interpret the return value of a function directly as an array?
lets say i have a function:
function getArray() {
return array("foo", "bar");
}
instead of writing:
$array = getArray();
$var = $array[1];
i want to access "bar" directly somewhat like:
$var = getArray()[1]; //this causes an error
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…