分享一起代码

WBOY
Release: 2016-06-13 11:21:13
Original
982 people have browsed it

分享一行代码
$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" }
Related labels:
source:php.cn
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