Re: Help with calling PHP functions

From: Date: Sat, 26 Apr 2008 19:15:52 +0000
Subject: Re: Help with calling PHP functions
References: 1 2  Groups: php.internals php.internals 
Request: Send a blank email to internals+get-37249@lists.php.net to get a copy of this message
Thanks for responding. May be I mis-wrote. What I would really like is a way to call the native c functions of the php implementation directly (bypassing the PHP compiler) like: PHP_FUNCTION(str_repeat) PHP_FUNCTION(addcslashes) etc. In other words I would like to invoke this functions directly thru C or Java. I do not want to callback into a PHP script user function Thanks, -Dhiru Edward Z. Yang wrote:
Dhiru Pandey wrote:
I am trying to figure out a way to invoke PHP functions directly i.e. bypassing the PHP compiler (scanner and parser). For now it would be great if I can get some help calling them from C. Ultimately I would like to call them from Java.
It's not difficult to call PHP_FUNCTIONs if you're inside PHP: you create a zval with the appropriate callback value (a string if you're dealing with global PHP functions) and then use call_user_function. You can find detailed instructions here: http://www.php.net/~wez/extending-php.pdf Can't help you for the other, although "Extending and Embedding PHP" by Sara Golemon, George Schlossnagle and Wez Furlong covers that topic, I think.


« previous php.internals (#37249) next »