Return Array from a function in PHP
Description
The following code shows how to return Array from a function.
Example
<?php// w ww .j a va 2 s . co m
function getArray() {
return array(1, 2, 3);
}
// on PHP 5.4
$secondElement = getArray()[1];
// previously
$tmp = getArray();
$secondElement = $tmp[1];
// or
list(, $secondElement) = getArray();
?>