您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

这两种写法等价吗

2025/4/5 9:45:34发布66次查看
strpos($tplpath,':') !== false
strpos($tplpath,':') !== “ ”
或strpos($tplpath,':') !== null
或strpos($tplpath,':') !== 0
上在是不是都是等价的
回复讨论(解决方案) 不等价!
strpos 函数,成功返回从0算起的偏移量,不成功返回 false
!== 不等于,比较时连同数据类型一起比较
strpos($tplpath,':') !== false  这是正确的
strpos($tplpath,':') !== “ ”  strpos要么返回数值,要么返回逻辑假,不会返回字符类型,条件恒成立
strpos($tplpath,':') !== null  同上
strpos($tplpath,':') !== 0  含义变了,变成判断第一个字符是否为“:”
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product