Re: Re: PHP & XML
| From: | Rasmus Lerdorf | Date: | Sat, 08 Dec 2001 01:08:56 +0000 |
| Subject: | Re: Re: PHP & XML | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-72914@lists.php.net to get a copy of this message | ||
> >Guys, relax. No, this does not work. The only reason your example works
> >is because min() is a built-in PHP function already.
> >
>
> man now i am crushed... i knew it wouldn't work - that's why i never
> tried. i was so amazed when i tried that i must have been blind to the fact
> that i chose a bad example...
>
> has anyone every thought of adding such a thing? the dev team can surely
> appreciate it because #defined macros are all over the php source.
You can use create_function() to do something like that. See
http://php.net/create_function
Or simply make a function. The point of macros in a language like C is
that they are processed before compilation and a real function call is
avoided. This does not apply to a non-compiled language like PHP so there
is no reason not to simply create a PHP-level function if you want
something like that.
-Rasmus