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

Posted by Kimmo Laine on 12/20/40 11:44

"Emil" <emjot_wytnij_to_@podczta.onet.pl> wrote in message
news:e15ag1$3ee$1@news.onet.pl...
> Is there any hope that new versions of PHP
> will support macros similar to C or C++?
> I've searched manual and didn't find anything
> except define directive, but it can be used
> to define constant values only.
> Of course it is not THAT neccessary functionality,
> but it could be very useful.
>


What's the actual difference between a function and a macro? How would use
of macros differ from functions?

Let's pretend there is a way of defining a macro in php...
define ("MAX($a,$b)", "(($a<$b)?$b:$a)");

vs.

function max( $a, $b ) {
return $a < $b ? $b : $a;
}

And use them like this:
MAX($a,$b); // This is macro, so much easier!
max($a,$b); // This is plain old dull function! Bah, no no, not like
this...

I mean.... WTF?

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)

 

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

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