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

Posted by Emil on 11/01/41 11:44

Kimmo Laine napisał(a):

>> $var = isset($_POST['postvar']) ? $_POST['postvar'] . 'default value';
>>

I have the same problem.

>
> And tell mme again why you couldn't write a function instead of a macro to
> do that?

The reason is when you pass $_POST['postvar'] to a function and
$_POST['postvar'] is not set, PHP generates warning. Of course one could
turn off warnings and usually does, but in my opinion it's not a
solution. However checking everytime if variable (or array index) is set
before passing it to a function generates sometimes tones of similar
code which could be simply replaced with one elegant macro.
Maybe it's just a matter of programmer's habit, I feel lack of macros.

Greetz Emil

 

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

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