|
Posted by Chung Leong on 11/18/11 11:44
Jerry Stuckle wrote:
> Macros are more efficient.
>
> Personally, one construct I use heavily and would like to replace with a macro:
>
> $var = isset($_POST['postvar']) ? $_POST['postvar'] . 'default value';
>
> I use something similar for a get/post, session and cookie values. It would be
> very nice to have a macro.
I think the operation is common enough that it deserves a function-like
operator. Something like
$val = coalesce($_POST['postvar'], $_SESSION['postvar'], 'default
value');
Navigation:
[Reply to this message]
|