I read it's possible to use C/C++ code in PHP by writing an extension. Is there a simpler way, like wrapping magic or things like that (I must say, I heard the word, but don't know much about what a wrapper is).
PHP will not run your C code, even though they have similar syntaxes. The PHP exec function will execute a command similar to how it is done in a shell or command prompt. You could exec gcc -o myc myc.
The PHP-CPP library uses all the power offered by C++11 to convert the parameters and return values from your functions to/and from PHP. The function above is a native C++ function. With PHP-CPP you can export this function to PHP with only one single C++ method call.
php file extension refers to the name of a file with a PHP script or source code that has a ". PHP" extension at the end of it. It's similar to a Word file with a . doc file extension.
Compiling a php extension isn't very hard. There is a little API to learn just like C programs has the main function and how to pass variables to the main function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With