I have heard that calling C function within the PHP is possible How do we call C function in PHP? If anyone come across this please let me know. This will be an added information in my knowledge.
I have heard that calling C function within the PHP is possible How do we call C function in PHP? If anyone come across this please let me know. This will be an added information in my knowledge.
We can call some of the C functions from PHP, like printf() fputs() fwrite() fgetc() exit() and so many others. You can write a SOAP webservice in C and then call it using PHP. But we cannot call all of C functions for example we cannot call initgraph() function that is a part of turbo C and I don't think that there is any way to call custom C functions from PHP
Even though we can call C functions in php but at the same time You can't call a function inside another program written in totally different language in php. What you can do is you can write a program in c and call the program from command line with commandline arguments and echo the output. You could also make your own PHP module with the functions in it. Why do you want to call C functions within PHP?
PHP has many native functions that have the same name as C functions and which act in similar ways but they are not C functions they are PHP functions. If you are using Windows and the API is contained within a DLL (which is often the case) then you could call it via rundll32, which you can call via the PHP system() function.
Bookmarks