您现在的位置是:首页 > PHP技术PHP技术
php变量布尔值验证详细参考
2018-03-20【PHP技术】1841 人已围观
简介使用 PHP 函数对变量$x进行比较表达式gettype()empty()is_null()isset()boolean:&...
表达式 | gettype() | empty() | is_null() | isset() | boolean : if($x) |
---|---|---|---|---|---|
$x = ""; | string | TRUE | FALSE | TRUE | FALSE |
$x = null; | NULL | TRUE | TRUE | FALSE | FALSE |
var $x; | NULL | TRUE | TRUE | FALSE | FALSE |
$x is undefined | NULL | TRUE | TRUE | FALSE | FALSE |
$x = array(); | array | TRUE | FALSE | TRUE | FALSE |
$x = false; | boolean | TRUE | FALSE | TRUE | FALSE |
$x = true; | boolean | FALSE | FALSE | TRUE | TRUE |
$x = 1; | integer | FALSE | FALSE | TRUE | TRUE |
$x = 42; | integer | FALSE | FALSE | TRUE | TRUE |
$x = 0; | integer | TRUE | FALSE | TRUE | FALSE |
$x = -1; | integer | FALSE | FALSE | TRUE | TRUE |
$x = "1"; | string | FALSE | FALSE | TRUE | TRUE |
$x = "0"; | string | TRUE | FALSE | TRUE | FALSE |
$x = "-1"; | string | FALSE | FALSE | TRUE | TRUE |
$x = "php"; | string | FALSE | FALSE | TRUE | TRUE |
$x = "true"; | string | FALSE | FALSE | TRUE | TRUE |
$x = "false"; | string | FALSE | FALSE | TRUE | TRUE |
以上是平时开发中的注意事项,有疑问的大家可以验证下哈欢迎指正
细节才是最重要的!
关注宁波网站建设博客,更多精彩分享,敬请期待!
Tags:
很赞哦! ()
相关文章
随机图文
Thinkphp5.1.30 Session使用笔记
原生PHP使用session过程<?php session_start(); session("username&q...PHP学习笔记:PHP遍历数组的几种方法
PHP中遍历数组有三种常用的方法: 一、使用for语句循环遍历数组; 二、使用foreach语句遍历数组; 三、联合使用list()、...Thinkphp配合ueditor文本区域自动添加p元素问题
这个问题没试用自己的企业网站管理后台没有发现.如果对一篇文章多按几次编辑提交按钮,发现正文内容在最前端不停在添加标签.这是因为在后台调用...PHP str_pad函数使用注意点
定义和用法str_pad() 函数把字符串填充为新的长度。语法str_pad(string,length,pad_string,pad_ty...