|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-07-30 13:04 UTC] zak@php.net
[2000-08-15 10:10 UTC] waldschrott@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 10 08:00:02 2026 UTC |
it seems that PHP4RC1 doesn't evaluate logical statements in the same way as PHP3 did . this causes some errors which (at first glance) looked to me as MySQL driver errors where a valid SQL statement, when implemented in a code similar to this : if ($result = mysql_query($query) && $row = mysql_fetch_array($result)) { would return a mysql warning : "Supplied argument is not a valid MySQL result ersource" on the mysql_fetch_array command. I think this happens because PHP4 doesn't evaluate the mysql_query part before the mysql_fetch_array part, which results in the fact that the $result variable isn't set in time for the mysql_fetch_array command. this behavior could be well demonstrated by the two following pieces of code : 1) $t = 1; if ( $t = $t + 1 && $w = $t + 1 ) { echo "right ! t: $t w: $w"; } else { echo "wrong! t: $t w : $w"; } 2) $t = 1; if ( ($t = $t + 1) && $w = $t + 1 ) { echo "right ! t: $t w: $w"; } else { echo "wrong! t: $t w : $w"; } which although they look semanticly the same give different results.