Php – Passing data from C++ to PHP


I need to pass a value from PHP to C++. I think I can do with PHP's passthru() function.
Then I want C++ to do something to that value and return the result to PHP.
This is the bit I can't work out, does anyone know how to pass data from C++ to PHP?
I'd rather not use an intermediate file as I am thinking this will slow things down.

Best Solution

You could have your c++ app send its output to stdout, then call it from PHP with backticks, e.g.

$output=`myapp $myinputparams`;