On Wed, 20 Aug 2003, Stefan Walk wrote:

> Won't work.
> [EMAIL PROTECTED]:~$ php -r 'var_dump(isset($var) || is_null($var));'
> 
> Notice: Undefined variable:  var in Command line code on line 1
> bool(true)

Ah yes.  I was writing from the perspective of having set a value to 
null beforehand.  My bad.

> > 2.) variable_exists can not be written in PHP.
> 
> And it is not necessary, because get_defined_vars() exists.

Which is just plain gross, but let's continue on...

> Noone ever said said that. 

Actually Zeev did.

> Still no need to test for their existance, imo.

I agree.  Apparently you missed this part:

> > This is a moot point, of course; I initialized the variable, so calling 
> > isset to check for existence would be silly.

Back to your message...

> Since your presumptions are flawed, the conclusion is also.
> And, given good design, where would you need it?

Why do things always come down to the wonderfully nebulous "good 
design"?  What is "good design"?  And now that you've demonstrated that 
the isset+is_null check doesn't work, the issue becomes even more 
prevalent - since there is now no way to escape.

Personally, I would never use variable_exists.  But if you want to say
get_defined_vars works, why do we have function_exists?  I could just as
easily say, "Use get_defined_functions and check for the function you
want.  function_exists is a waste of time and bad design."  It's a
completely arbitrary and subjective position.  The inconsistency itself
should say something about this issue.

So I ask this:

get_declared_classes, class_exists
get_defined_functions, function_exist
get_defined_constants, defined
get_defined_vars, ???

Or does PHP win the language inconsistency award?

-- 
Shaun M. Thomas                INN Database Administrator
Phone: (309) 743-0812          Fax  : (309) 743-0830
Email: [EMAIL PROTECTED]    Web  : www.townnews.com


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to