note 19704 deleted from language.operators by sniper

From: Date: Mon, 13 Oct 2003 00:03:19 +0000
Subject: note 19704 deleted from language.operators by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-58355@lists.php.net to get a copy of this message
Note Submitter: php.at.michrev.com ---- If this doesn't work: ($val) ? echo('true') : echo('false'); ...you should use this: if($val) { echo('true'); } else { echo('false'); } ...or, better yet, this: echo($val ? 'true' : 'false'); ...because $val, 'true', and 'false' are all expressions, but echo() is not. The "expr?expr:expr" operator is used to select between expressions in the middle of a command. If you need to select between different commands instead, it's probably better to use if() instead. That's what it's there for.

« previous php.notes (#58355) next »