Home > Backend Development > PHP Tutorial > PHP5.4开始数组成员访问支持函数返回值访问

PHP5.4开始数组成员访问支持函数返回值访问

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-20 13:04:56
Original
969 people have browsed it

PHP数组成员访问解析(Array dereferencing*)

处理数组再也不需要临时变量了。

假设我们需要获取Fang Bin Xin的middle name,

PHP5.4开始数组成员访问支持函数返回值访问

echo explode(‘ ‘, ‘Fang Bin Xin’)[1]; // Bin
Copy after login

PHP 5.4之前,我们需要这样:

$tmp = explode(‘ ‘, ‘Fang Bin Xin’);

echo $tmp[1]; // Bin
Copy after login

现在,我们可以这样玩了


Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template