<?phpfunction getArray() {
return array(1, 2, 3);
}// on PHP 5.4$secondElement = getArray()[1];// previously$tmp = getArray();$secondElement = $tmp[1];// orlist(, $secondElement) = getArray();?>// previously
$tmp = getArray();
$firstElement = $tmp[0];
$secondElement = $tmp[1];
// or
var_dump (list($firstElement, $secondElement) = getArray());
echo '**'.$firstElement;
echo '**'.$secondElement;
Attempting to access an array key which has not been defined is
the same as accessing any other undefined variable:
an
E_NOTICE-level error message will be
issued, and the result will be NULL.
No comments:
Post a Comment