How to use php-cli with Linux C++

I am making a software using C++, which needs to process a lot of data. C++ makes me feel uncomfortable, and I want to use PHP to deal with these data classes. I have searched a lot of information, but there is very little information about how C++ indirectly uses php-cli, which I know may involve the application of some underlying PHP apis. But I couldn’t find any information about it.

I want to be able to package PHP with my files in any environment that supports C++, and then I can use it in C++. Crucially, something like this:

cout << php("echo 'xxxx';" );

or

cout << php("preg_match('/^(-)? (d+)/',string)");

I know this can involve a lot of knowledge, I’m new to Linux, and I’m just hoping to get some direction.