Blogger Information
Blog 28
fans 0
comment 0
visits 16436
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
isset、empty、is_null手抄作业-2018年4月16日23时51分
植树青年小江同志的博客
Original
542 people have browsed it

1. isset
功能和返回值:判断变量是否被初始化 ,变量已经存在,并且它的值不为null,返回true,否则为false

参数:只能是变量

2. empty

功能和返回值:检测变量是否为“空”

若变量不存在,返回 true

变量存在情况下,值为空,返回 true

null, 0 , false, 都将返回 true

总结:任何一个未初始化的变量、值为 0 或 false 或 空字符串”" 或 null的变量、空数组、没有任何属性的对象,都将判断为empty==true 

参数:只能接受变量


3. is_null
功能和返回值:检测变量是否为“null” ,变量不存在,未赋值和值为null是,返回true,

总结:仅在变量的值为“null”时,检测结果才为true,0、空字符串、false、空数组都检测为false

变量未初始化时,返回false,但程序将会报错

IMG_1662.jpgIMG_1663.jpgIMG_1664.jpg

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!