note 36189 deleted from control-structures by didou

From: Date: Wed, 25 Feb 2004 10:55:56 +0000
Subject: note 36189 deleted from control-structures by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-65703@lists.php.net to get a copy of this message
Note Submitter: molotov@molotov.eu.org ---- You definitely can write a simple control structure like this: <?php if ($var > 5) { $answ = $var1; } else { $answ = $var2; } ?> But there is a much shorter way: <?php $answ = ( $var > 5 ? $var1 : $var2 ); /* $result = ( $expression ? $return_if_true : $return_if_false ) */ ?>

« previous php.notes (#65703) next »