note 56751 deleted from function.isset by cmb
| From: | cmb@php.net | Date: | Sun, 05 Jan 2020 08:09:19 +0000 |
| Subject: | note 56751 deleted from function.isset by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213736@lists.php.net to get a copy of this message | ||
Note Submitter:
----
I don't know if you guys can use this but i find this piece of code pretty useful (for
readabillity at least):
function isset_else( $&v, $r )
{
if( isset( $v ))
return $v;
else
return $r;
}
This way you can go:
$a = 4;
$c += isset_else( $a, 0 );
$c += isset_else( $b, 0 );
echo $c;
Of course, this code would work anyway, but you get the point.