开发者

Use PHP functions in PHP extension

开发者 https://www.devze.com 2023-02-08 22:58 出处:网络
开发者_开发技巧Can I use a PHP function such as explode() when creating an extension in C++?Here it is: PHP_FUNCTION(explode) expands to zif_explode with these parameters. That\'s the function you sho

开发者_开发技巧Can I use a PHP function such as explode() when creating an extension in C++?


Here it is: PHP_FUNCTION(explode) expands to zif_explode with these parameters. That's the function you should call.

Read this for more details.


PHP functions are usually implemented as parameter type checks followed by calling a native function, usually with the same name prefixed by php_.

For example, explode calls either php_explode or php_explode_negative_limit depending on the value of the third parameter (look at the source).

You can get the prototypes for these by including <ext/standard/php_standard.h>.

Make sure to check the implementation of the original PHP function for the preconditions on the arguments.

0

精彩评论

暂无评论...
验证码 换一张
取 消