`
janwen
  • 浏览: 14635 次
  • 性别: Icon_minigender_1
  • 来自: 济南
文章分类
社区版块
存档分类
最新评论

PHP Boolean注意

阅读更多

 猪头     今天上班真他妈的没状态,一天不知道想干么,好像还有一种莫名的紧张,烦躁,不安,说不出来的感觉,职业迷茫期不会又来了吧 强 ,那就上博客写篇博客,其实我是一个优秀的员工, 爽 一只大苍蝇在我办公位飞了一天了, 酷 上午还打算再找找PHP面向对象的知识学习学习,发现国内估计很少用php的面向对象开发,都是基于面向过程的,找资料都找不到,都是看英文的,看到一点关于PHP数据类型的文章,下面是一老外关于Boolean数据类型的特别注意性质的介绍,我还真不知道,很多情况下都是FALSE,这个跟很多语言不太一样

 

Boolean data types represent two possible states — TRUE or FALSE. Boolean values are used mainly to compare conditions for use in conditional statements. For example, PHP evaluates an expression, such as $a > $b, and the outcome is either TRUE or FALSE.

PHP considers the following values FALSE :
The string FALSE (can be upper- or lowercase)
The integer 0
The float 0.0
An empty string
The one-character string 0
The constant NULL

Any other values in a Boolean variable are considered TRUE. If you echo a Boolean variable, the value FALSE displays as a blank string; the value TRUE echoes as a 1. Functions often return a Boolean variable that you can test to see whether the function succeeded or failed.

 

PHP太灵活了,我觉得也很没有标准,学习起来特步方便 微笑 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics