I saw this post on Sitepoint quoting a statement by Rasmus Lerdorf which goes (according to Sitepoint) as follows:
How can you make PHP fast? Well, yo
For large calculation and processing C++ can be used with php. And for lighter process only PHP is enough.
While working on data processing or calculation based applications C++ can help. Please not you have to use one trick here.
One need to create server(daemon) process which keep listerning for the request. This daemon process is already compiled and it contains processing code.
So when there is any request to process the data it will do it much faster then PHP and reply back with result.
One can use exec
or similar function to execute daemon executable.