You are here: Re: Macros in php « PHP Programming Language « IT news, forums, messages
Re: Macros in php

Posted by Chung Leong on 10/28/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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация