Working on a small extension for PHP using PHP-CPP, I receive at C++ side, an array with objects and I need retrieve the class name of it. The object Php::Value didn't looks like have any method for it.
Similar as i do at HNI in this extension: https://github.com/mcuadros/bson-hni/blob/master/src/encode.cpp#L86
You are right, there is no special method to determine the classname in C++ in the Php::Value object. The best way to determine the classname is thus to use the Php::call method to call the get_class method in PHP userspace:
std::string classname = Php::call("get_class", object);
Where object is one of the objects in the mentioned array.
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