Re: Looking for caveats to the following code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, August 17, 2006 5:19 pm, Chris W. Parker wrote:
> The issue is whether or not this is a safe test. My initial thought is
> that it is safe since I'm simply checking for true/false-ness. I
> either
> check for '!== false' explicitly or (in the case of the latter
> example)
> check that something other than 'false' is returned.

It would probably be better to check:
if (do_something('hello') !== false){
}

> It's slightly less readable but it seems more efficient (if nothing
> more
> than to save on the number of lines typed).

Really, though, the question is more about 'hello' and where it comes
from than anything else.

If you have already scrubbed and validated 'hello' and you know it
does not start with the digit 0, and it's not an array, and...

Actually, to be correct, you should be able to say what 'hello' *IS*
rather than what it is not.

The rest of the code all hinges on the question of what's in the REAL
world for 'hello'

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux