字符串类型转化为布尔值
What happens when a false value is casted to a string?
将false值强制转换为字符串会怎样?
I.e. what is the result of the following: < ?php var_dump((string)false); ?>
即以下结果是什么:<?php var_dump((string)false); ?>
The answer is: string(0) ""
答案是: string(0) ""
This is good to know and expect when using some string functions that sometimes return a string and sometimes a boolean. Such functions are strstr(), strpos(), etc.
当使用某些有时返回一个字符串,有时返回一个布尔值的字符串函数时,这是一个很好的认识和期望。 此类函数为strstr(),strpos()等。
Tell your friends about this post on Facebook and Twitter
在Facebook和Twitter上告诉您的朋友有关此帖子的信息
翻译自: https://www.phpied.com/booleans-casted-to-strings/
字符串类型转化为布尔值
最后
以上就是怕孤独灯泡最近收集整理的关于字符串类型转化为布尔值_布尔值转换为字符串的全部内容,更多相关字符串类型转化为布尔值_布尔值转换为字符串内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复