|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-01-07 07:53 UTC] mickael dot bailly at free dot fr
Don't know if it's a bug or a feature... :)
$test = array ('a' => 'coooool','b' => $ddfdfdf);
if ( isset($test['b']) ) {
echo "OOOK ! \n";
}
echoes nothing, and
$test = array ('a' => 'coooool','b' => "$ddfdfdf");
if ( isset($test['b']) ) {
echo "OOOK ! \n";
}
echoes OOOK
Is this normal ?
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 08:00:01 2025 UTC |
Yes it $ddfdfdf is empty, isset will return FALSE. According to the following script : <?php $test = array ('a' => 'coooool','b' => "$tests"); if (isset($test['b']) ) { echo "OK 1! \n"; } $test = array ('a' => 'coooool','b' => $tests); if ( isset($test['b']) ) { echo "OK 2! \n"; } $tests = "lol"; $test = array ('a' => 'coooool','b' => $tests); if ( isset($test['b']) ) { echo "OK 3! \n"; } ?> That returns: OK 1! OK 3! If you set an element of an array to a variable that is empty, isset will definatly return FALSE. Excepted behaviour.