一個盼望已久的特性,終於有了,轉之~
Array dereferencing是個好東西, 有了Array dereferencing, 以前的這種寫法就再也不必要了:
<?php
list($name,) = explode(",", "Laruence, male");
?>
取而代之的是:
$name = explode(",", "b, x")[0];
另外, Array derefencing也可以出現再賦值語句的左值中, 也就是理論上你可以這麼寫:
explode(",", "test1, test2")[3] = "phper";