note 8933 added to Logical Operators

From: Date: Fri, 06 Oct 2000 19:18:03 +0000
Subject: note 8933 added to Logical Operators
Groups: php.notes 
Request: Send a blank email to php-notes+get-6181@lists.php.net to get a copy of this message
My brain still stings. The following conundrum has just devoured several hours of my time. I wanted to output a certain string if a variable had a certain value. I tried: ($foo == "some value") && (echo ("some string")); I bravely offered it to PHP innumerable times, and all I got was a lousy "Parse error". No one knew what the problem was. When I finally tried: ($foo == "some value") && (print ("some string")); it worked flawlessly. Be warned. Echo evidently has issues. If you get a weird error with echo (in this particular context, or elsewheres) try print instead. http://www.php.net/manual/language.operators.logical.php

« previous php.notes (#6181) next »