Reputation: 39901
Can I write a C++ code that can be compiled and used for extending PHP (I don't mean calling an executable file)? Can I describe some classes, functions and use them for in my PHP code by calling the compiled (.so or .a file) C++ code? If yes, then please explain me schematically how it is being done.
Upvotes: 0
Views: 1347
Reputation: 359
The Zend engine is a good option as already mentioned in the previous answer.
Other alternative is SWIG (it supports multiple languages)
Specifically, for php with C++, you can refer to:
http://www.swig.org/Doc1.3/Php.html
Upvotes: 2
Reputation: 522626
Yes, you can do so by writing a PHP extension.
See PHP at the Core: A Hacker's Guide to the Zend Engine.
Upvotes: 4