Boolean-cast and arrays

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

 



First thank you all for your input on "all-in-one" classes.

Reading the php manual on boolean types and casts, and came accros the
following:

<quote>
When converting to boolean, the following values are considered FALSE:

...

an array with zero elements

...
</quote>

So here I am sitting and wondering if after all this while doing:

$arr = array();
If (count($arr) == 0) {}

Shouldn't have been simply doing:

$arr = array();
If (!arr) {}


Is the latter problematic in any programming standards? 
Does it take longer to process? 
Is it using count()?
Is "Type-Juggling" considered good practise? 

Regards,

Tim

-- 
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