Re: [PHP] distinguish between null variable and unset variable



On Wed, Jan 21, 2009 at 20:27, Jack Bates <ms419@xxxxxxxxxxxxxx> wrote:
How can I tell the difference between a variable whose value is null and
a variable which is not set?

Unfortunately, in PHP - like other languages - you can't.

A variable is considered to be null if:
* it has been assigned the constant NULL.
* it has not been set to any value yet.
* it has been unset().

--
</Daniel P. Brown>
daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!
.



Relevant Pages

  • Re: Case sensitivity in programming languages.
    ... Every time someone creates a post about case sensitve languages I reserve ... At least not in PHPP, ... Thus I can create different things called 'foo' and reference each ... sensitive languages trying to force case sensitivity into ALL languages. ...
    (comp.lang.php)
  • Re: PHP as a secure language? PHP worms? [was: Re: new linux malware]
    ... _Programming Languages: Concepts and Paradigms_ he defines some of the paradigms of programming languages; on pp 12-13, ... This book is classic but doesn't list Perl or PHP or Java -- but the concepts are the same. ...
    (Bugtraq)
  • Re: Php invented by a former DECcie ?
    ... Dijkstra would have said about these languages as compared to his ... PHP does not even have a goto statement. ... It's not the perfect scripting language but it has gotten a lot better over the years. ... If Perl or PHP will get it done faster that's what you use. ...
    (comp.os.vms)
  • Re: PHP global namespace clogged up
    ... Only a bad programmer would confuse the two. ... PHP does not have linking. ... > This is why most programming languages have namespaces - and use them. ... None of the languages I have used in the past 30 years have had namespaces. ...
    (comp.lang.php)
  • Re: PHP global namespace clogged up
    ... This is why most programming languages have namespaces - and use them. ... > PHP functions do not need all that bloat to work, so again I say "it is not ... The benefits of OO design mainly show up when building large projects, ...
    (comp.lang.php)