|
Posted by Kimmo Laine on 10/31/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]
|