Home >Backend Development >PHP Tutorial >Detailed explanation of output based on empty function_PHP tutorial

Detailed explanation of output based on empty function_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:05:40875browse

$a = '';
echo '1.---------------'.empty($a).'
';
$a = '0';
echo '2.---------------'.empty($a).'
';
$a = 0;
echo '3.---------------'.empty($a).'
';
$a = null;
echo '4.---------------'.empty($a).'
';
$a = 'null';
echo '5.---------------'.empty($a).'
';
$a = 'abc';
echo '6.---------------'.empty($a).'
';
$a = true;
echo '7.---------------'.empty($a).'
';
$a = 'true';
echo '8.---------------'.empty($a).'
';
$a = false;
echo '9.---------------'.empty($a).'
';
$a = 'false';
echo '10.---------------'.empty($a).'
';
$a = 1;
echo '11.---------------'.empty($a).'
';
$a = '1';
echo '12.---------------'.empty($a).'
';
$a = 'null';
echo '13.---------------'.!empty($a).'
';
结果:
1.---------------1
2.---------------1
3.---------------1
4.---------------1
5.---------------
6.---------------
7.---------------
8.---------------
9.---------------1
10.---------------
11.---------------
12.---------------
13.---------------1

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/327671.htmlTechArticle$a = ''; echo '1.---------------'.empty($a).'br'; $a = '0'; echo '2.---------------'.empty($a).'br'; $a = 0; echo '3.---------------'.empty($a).'br'; $a = null; echo '4.-----------...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn