码迷,mamicode.com
首页 > 其他好文 > 详细

字符串和数字比较

时间:2016-07-07 22:41:51      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:php



簡單說 0 == “string" 會恆為 true 的原因就是:


因為字串轉換成 integer 會變成 0 (使用 strtod() 來作 ATOI 的時候, 無法轉換 就會變成 0), 所以用 === 解決 或是 將0改為字串"0" 


本文出自 “陪你度过漫长岁月” 博客,请务必保留此出处http://4774721.blog.51cto.com/4764721/1812423

字符串和数字比较

标签:php

原文地址:http://4774721.blog.51cto.com/4764721/1812423

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!