Home  >  Article  >  php教程  >  加速你的php数组

加速你的php数组

WBOY
WBOYOriginal
2016-06-13 08:54:21730browse

加速你的php数组

有个二维数组

 

$g=array(
'foo'=>array(
'bar'=>1  

),


);

 

 

如果要访问到bar的值 传统需要这样访问 

 

$g['foo']['bar']

 

但是换个思路 可以如下访问

 

$g['foo.bar'] 或则 $g['foo_bar']

等等各种形式 由此可以扩展到三维数组 

甚至js 可以这么写 这样一来 速度必然提上去

Statement:
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
Previous article:PHP7革新与性能优化(1)Next article:php时区设置小结