Re: Broken IF behavior? (Changing the branch changes the evaluation)

From: Date: Wed, 29 Jul 2009 08:12:55 +0000
Subject: Re: Broken IF behavior? (Changing the branch changes the evaluation)
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-295996@lists.php.net to get a copy of this message
Matt Neimeyer wrote: > It's exactly what I would expect... The content of the row... But in > any case, what does changing the content of the { } branch have to do > with how the IF() itself is evaluated? > > array(4) { > [0]=> > string(8) "CustName" > ["config"]=> > string(8) "CustName" > [1]=> > string(11) "Sample Cust" > ["value"]=> > string(11) "Sample Cust" > } > > The if() *is* being evaluated *the same* whatever the content of that branch, but when there's no content, you see no result... It always looks odd to me to have empty if branches - why do you not just write if ($Ret) { return $Ret; } Anyway, the !$Ret branch is being executed because the fetch operation will return NULL (or FALSE or something equivalent) when there are no results. -- Peter Ford phone: 01580 893333 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent

« previous php.general (#295996) next »