Home  >  Article  >  Backend Development  >  分享一起代码

分享一起代码

WBOY
WBOYOriginal
2016-06-13 11:21:13951browse

分享一行代码
$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
Previous article:PHP 处置图片Next article:php页面间怎么传递参数