Like ternary but without the else.

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

 



Hello,

I couldn't find this anywhere on google or PHP's site but I'm pretty
sure there's an answer to it.

How can I turn the following into something that resembles the ternary
operator?

<?php

  if($something)
  {
    $this = $that;
  }

?>

I seem to remember it looking something like:

<?php

  $this = ($something) || $that;

?>

Although this isn't syntactically wrong, i.e. no errors, it did not do
what I hoped it would do. (What it does is assign 1/true.)


Thanks!
Chris.

p.s. No need to respond if your suggestion is:

<?php

  if($something) { $this = $that; }

?>

-- 
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