Re: Extending PHP
| From: | Richard Lynch | Date: | Thu, 04 Jan 2001 22:40:53 +0000 |
| Subject: | Re: Extending PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32752@lists.php.net to get a copy of this message | ||
> Implement PHP callable functions in c (there is some documentation for
this
> with PHP 3 in the manual)
Yes. Requires recompiling PHP itself, and knowledge of C and figuring out a
few C macros to wrap PHP-isms around your code.
> Implement functions/classes in PHP and include the script file
Easily extendible by the masses of PHP users.
> Implement PHP callable functions in Java (I don't think you really need
> documentation for this...)
Not sure PHP/Java interface is at production quality yet...
> Are there any other possibilities? Is there any way to dynamically extend
> PHP (rather than forcing a rebuild to get the new functions included...)?
Is
> there any documentation for extending PHP 4?
Yes, yes, and yes. :-)
PEAR -- PHP Extensible something or other. It's got its own mailing list.
You can find some basic "HowTo" samples in Rasmus' talks at computer geek
conferences, often posted online at http://conf.php.net
You still need to grok C and the macros, but it's easier to alter without
recompiling all of PHP.
> What about pros and cons to different methods? I think the simplest and
most
> friendly solution is writing classes in PHP, but I may run in to annoying
> limitations. Otherwise, I would most like to implement a PHP class in c,
but
> I can't find documentation on this. Is it as simple as naming your
functions
> <classname>::<method name> and referencing a local variable 'this' are is
> there more to it?
Huh? PHP classes are implemented in C. If you want to write a whole new
class system... Wow.
I doubt that you can just use PHP classes in C with some stuff like that...
But I dunno. Join the PEAR mailing list.
> Also, does any one know if there are plans to add destructor support to
PHP
> classes? It's a pretty glaring omission in my opinion...
It's on the list, but it's probably something pretty tricky or it would
already have been done -- Keep in mind that PHP's memory management is
*NOTHING* like C's or C++'s... Perhaps you could dive into the PHP code and
try to do it :-)