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

Posted by Gordon Burditt on 10/01/11 11:44

>> Macros are more efficient.

Anyone got actual PROOF that macros are more efficient in an
interpreted language? Claims that <language construct x> is
more efficient without specifying the language are almost always
false.

>> 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.
>
>
>And tell mme again why you couldn't write a function instead of a macro to
>do that?

Let's see you implement the equivalent of the C macros:

#define LENGTH (
#define FEET ) * 12.0 + (
#define INCHES )

used as:
LENGTH 6 FEET 3 INCHES

in a PHP function. Of course, abusing C macros like that should carry
the death penalty.

Gordon L. Burditt

 

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

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