maybe the object has a build method to get it as an integer?
Otherwise, try this very hacky approach (relies on __toString (), returning this value 10)
$total_results = $total_results->__toString(); $total_results = intval($total_results);
However, if the object has a built-in method without magic, you should use it!
source share