Home >Backend Development >PHP Tutorial > 分享一起代码

分享一起代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:48:52892browse

分享一行代码
$arr = array(2=>'PHP','2'=>'mysql','2.5'=>'linux',2.5=>'apache');  
var_dump($arr); 
先仔细思考下,然后再运行下结果。


------解决方案--------------------
'2.5'不变
'2'转为2
2.5取整为2
后面赋值的覆盖前面的

结果略
------解决方案--------------------
思考同上,结果如下:
array(2) { [2]=> string(6) "apache" ["2.5"]=> string(5) "linux" }
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