note 40898 added to control-structures.alternative-syntax

From: Date: Thu, 18 Mar 2004 15:22:39 +0000
Subject: note 40898 added to control-structures.alternative-syntax
Groups: php.notes 
Request: Send a blank email to php-notes+get-67018@lists.php.net to get a copy of this message
As a rection on sttoo, if you use nested if's a bit different they are less likely to cause mistakes: <?php $one = true; $two = true; $result = ($one ? "one" : ($two ? "two" : "none")); // $result is "one" $one = false; $result = ($one ? "one" : ($two ? "two" : "none")); // $result is "two" $two = false; $result = ($one ? "one" : ($two ? "two" : "none")); // $result is "none" ?> ---- Manual Page -- http://www.php.net/manual/en/control-structures.alternative-syntax.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40898 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40898&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40898&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#67018) next »