RE: [PHP] Re: Like ternary but without the else.

From: Date: Sat, 26 Feb 2005 01:35:03 +0000
Subject: RE: [PHP] Re: Like ternary but without the else.
Groups: php.general 
Request: Send a blank email to php-general+get-209483@lists.php.net to get a copy of this message
Jason Barnett <mailto:jason.barnett@telesuite.com> on Friday, February 25, 2005 2:10 PM said: > $this = $something ? $that : null; That won't work because I'm setting a default value for $this and want it to change only if it has to. The long winded way to write this would be: <?php $myVariable = "default"; if($somethingElse == "a value") { $myVariable = "new value"; } else { // don't do anything } ?> Chris.

« previous php.general (#209483) next »