programming languages - In PHP, if a variable does not have a value, why does isset() still return TRUE? -
here code:
<?php $ja = ''; if(isset($ja)) echo "cool!"; ?>
i "cool!" when running simple piece of code in browser. learned php.net
isset — determine if variable set , not null
well, in code, did declare variable $ja, didn't add value it, shouldn't "null"?
even though '' seems nothing, still has value (a null character @ end of string).
isset()
checks if variable set or not, in case (to ''), is. may want set $ja null first beforehand, instead of setting empty string... or use empty()
;)
Comments
Post a Comment