assignment operator works for comparison??
| From: | Dan | Date: | Tue, 10 Apr 2001 20:53:16 +0000 |
| Subject: | assignment operator works for comparison?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-48077@lists.php.net to get a copy of this message | ||
This confused me for awhile, because the single equal sign seemed to work
for comparison, but created inexplicable errors in my programs. It seems
strange to me that a successful variable value assignment does not return
true.
example:
<?
$shiny = 1;
if($shiny = 0){ echo("This wont print"); }
echo( $shiny ); //this will return 0
?>
--Dan