Re: php compiler
| From: | Marek Kilimajer | Date: | Sat, 30 Oct 2004 14:11:32 +0000 |
| Subject: | Re: php compiler | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-200716@lists.php.net to get a copy of this message | ||
Marek Kilimajer wrote:
Mike wrote:ok, precedence :)You're assigning values in your test. Use == instead of = in the if condition.hmm, but he should not get what he gets anyways: $a = 1 - evaluates to true, continue $b = 0 - evaluates to false, so the whole if() condition is false, jump to else and print:
false 1 0 He gets: true false 0 I get (php-5.0.2): false false 0 Or am I missing something?=M -----Original Message----- From: Hodicska Gergely [mailto:felho@avalon.aut.bme.hu] Sent: Saturday, October 30, 2004 9:50 AM To: php-general@lists.php.net Subject: [PHP] php compiler Hi! $a = 0; $b = 1; if ($a = 1 && $b = 0) {echo 'true '; var_dump($a); var_dump($b);} else {echo 'false '; var_dump($a); var_dump($b);} Runing this we get: "true bool(false) int(0)" After the precedence table the first step could be evaluating the &&, but not this is what happen. Can someone exactly explain how PHP process the condition? THX in advance, Felho