On 16 September 2015 23:39:30 BST, Lester Caine <les...@lsces.co.uk> wrote:
>On 16/09/15 22:23, Rowan Collins wrote:
>>> 'exists but I don't know what
>>> >as yet' is a logical state
>> It is indeed. "I know it's name but it doesn't exist", however, is
>generally not a valid state - if you've hard-coded the name (as is the
>case with 99.9% of bare variables) then clearly you consider it to have
>some existence. For this reason, PHP assumes that you meant to create
>it with a null value.
>
>If I have a dozen objects 'hard coded', but the templating system only
>needs to use a few of them for this page then only the variables that
>have been created exist. Yes one would be better off scanning an
>associative array and only dealing with the elements actually present
>in
>the array. That is better coding practice, but extract() is an equally
>valid practice currently being used and that needs a different way of
>handling if the elements exist.

I'm still not entirely sure what it is you need to "handle".

What is the behaviour that you'd put in the if(! exists ()) block? More 
particularly, what would you put there and not put in the if(! is_null()) 
block, since if they're the same, then that's what if(! isset()) does, so we're 
all good?



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

Reply via email to