3

Can I use a PHP function such as explode() when creating an extension in C++?

1
  • C++ will explode all by itself, it doesn't need any help from PHP Commented Feb 8, 2011 at 0:29

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.