后端开发|php教程
php null空值(转)
后端开发-php教程
null(空值):PHP中一种特殊的数据类型,表示空值,即表示没有为该变量设置任何值null(空值)不区分大小写,null和NULL是一样的。
被赋空值可能有三种情况:没有赋什么值、被赋空值null、被unset()函数处理过的变量(出处:《PHP从入门到精通》P47。
网站首页设计源码,没有光驱安装Ubuntu,pycharm爬虫小例子,php caldav,seo营销预算lzw
实例如下:
<?php
echo “变量($string1)直接赋值为null”;
$string=null;//$string1被赋空值
$string3=”str”;//$string3被赋值str
if(is_null($strig1=null)){ //判断$string1是否为空
echo ‘string=null’;
}
echo ‘
在线数据查询系统 源码,Ubuntu主目录路径,tomcat 9一闪而过,爬虫时间段,php还值得学吗,seo时间因子lzw
‘;
echo ‘变量($string2)没有被赋值’;
if(is_null($string2=null)){ //判断$string1是否为空
echo ‘string=null’;
}
echo ‘
flash网站源码 免费,ubuntu 启动速度优化,tomcat执行异常指令,美国爬虫箱,php实现线程锁,五家渠seo 网络推广销售电话lzw
‘;
echo ‘被unset()释放过的变量($string3):’;
unset($string3);
if(is_null($string3=null)){//判断$string1是否为空
echo ‘string=null’;
}
?>
浏览器处理结果:
变量($string1)直接赋值为nullstring=null
变量($string2)没有被赋值string=null
被unset()释放过的变量($string3):string=null
如果觉得《php null空值(转)》对你有帮助,请点赞、收藏,并留下你的观点哦!