PHP头条
热点:

PHP5.4新特性之Array dereferencing support


一个盼望已久的特性,终于有了,转之~
 
Array dereferencing是个好东西, 有了Array dereferencing, 以前的这种写法就再也不必要了:
 
<?php
    list($name,) = explode(",", "Laruence, male");
?>
取而代之的是:
 
$name = explode(",", "b, x")[0];
另外,  Array derefencing也可以出现再赋值语句的左值中, 也就是理论上你可以这么写:
 
explode(",", "test1, test2")[3] = "phper";

www.phpzy.comtrue/phprm/18711.htmlTechArticlePHP5.4新特性之Array dereferencing support 一个盼望已久的特性,终于有了,转之~ Array dereferencing是个好东西, 有了Array dereferencing, 以前的这种写法就再也不必要了: ?php list($name,) = explode(,, L...

相关文章

    暂无相关文章

PHP之友评论

今天推荐