揮発性のメモ2

http://d.hatena.ne.jp/iww/

isset($a)はNULLのときも偽になる

変数がセットされていること、そして NULL でないことを検査する

PHP: isset - Manual
<?
function hoge($a){
	var_dump($a);
	print( isset($a) ? "not NULL\n" : "this is NULL!\n" );
}

$b = [1=>"A"];
hoge($b[1]); // 存在する添え字

print("----\n");
hoge($b[0]); // 存在しない添え字

print("----\n");
hoge(NULL);  // 正真正銘のNULL
string(1) "A"
not NULL
----
NULL
this is NULL!
----
NULL
this is NULL!