It's considered bad practice to put assignments in conditions, for
reason said before,
and also because you can accidently assign a value in a condition.
By example:
I wanted to type
if ($loader == Zend_Amf_Parse_TypeLoader::loadType($className))
but there was tabacco under my = key again and i accidently wrote
if ($loader = Zend_Amf_Parse_TypeLoader::loadType($className))
(maybe a better warning would be:
Warning: Possible accidental assignment in condition)
Try to make yourself write the above like this:
if (false !== ($loader = Zend_Amf_Parse_TypeLoader::loadType($className)))
That way it's impossible to make mistakes, others can read your code more
easily, etc.
Another example:
if ($x == 10) // What if there was tabacco under my key again? $x = 10 is
always true :p
if (10 == $x) // Impossible to make a mistake here!
Regards,
Maghiel
On 6-2-2010 18:04, logart wrote:
Ah, ic.
Did find a typo in the line above it:
// Typed object lookup agsinst registered classname maps