RE: Re: Like ternary but without the else.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jason Barnett <mailto:jason.barnett@xxxxxxxxxxxxx>
    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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux