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太灵活了,我觉得也很没有标准,学习起来特步方便 微笑 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值