Home >Backend Development >PHP Tutorial >PHP Regarding the judgment results of empty and isset on parameters, emptyisset_PHP tutorial

PHP Regarding the judgment results of empty and isset on parameters, emptyisset_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-12 09:05:03830browse

PHP Regarding the judgment results of empty and isset for parameters, emptyisset

<?php
	class test{}
	$a1 = null;
	$a2 = "";
	//$a3 = 
	$a4 = 0;
	$a5 = '0';
	$a6 = false;
	$a7 = array();
	//var $a8;
	$a9 = new test();

	for ($i=1; $i <=9 ; $i++) { 
		$s = 'a'.$i;
		echo $i . ":";
		var_dump(isset($$s));
		echo '<br />';

	}
	echo '<br />';
	for ($i=1; $i <=9 ; $i++) { 
		$s = 'a'.$i;
		echo $i . ":";
		var_dump(empty($$s));
		echo '<br />';
	}

 

That’s basically it

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1070668.htmlTechArticlePHP Regarding the judgment results of empty and isset for parameters, emptyisset ?phpclass test{}$a1 = null;$a2 = "";//$a3 = $a4 = 0;$a5 = '0';$a6 = false;$a7 = array();//var $a8;$a9 = new test();f.. .
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