|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-09-23 08:15 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 15:00:02 2025 UTC |
Description: ------------ When you assign a new variable directly into an IF statement, it is not updated if you try to read from it in the same statement. The problem can be supressed by adding an extra set of parentheses, but I don't think that should be neccesary. In the example posted below, this would work just fine: if ( ( $a = 1 ) && $a > 0 ) { Reproduce code: --------------- $a = 0; if ( $a = 1 && $a > 0 ) { echo 'ok'; } else { echo 'wait, what?'; } Expected result: ---------------- ok Actual result: -------------- wait, what?