note 55748 deleted from language.operators by danbrown
| From: | danbrown@php.net | Date: | Fri, 30 Jan 2009 20:44:14 +0000 |
| Subject: | note 55748 deleted from language.operators by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150006@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster AT cafe-clope DOT net
----
I regularly use some syntax like :
<?php
if(!$myvar)
$myvar = $value ;
?>
and
<?php
if($myvar)
echo "myvar is $myvar today" ;
?>
(or <?php echo ($myvar ? "myvar is $myvar today" : "") ?>)
It's small, but can become heavy when used too much.
Isn't there some trick to better such syntaxes ?
I was wondering about using things like :
<?php $myvar ||= $value ; ?>
<?php $myvar ?= $value ; ?>
<?php echo ($myvar ? "myvar is $myvar today") ; ?>