PHP Count records

What if I just want to count the number of records in a table.

How do I do it the simplist way in PHP?

in response for find request server returns “totalObjects” with quantity of data objects in table.
you can use this value.

How do I actually get it?
I tried various ways like below:

$result_collection = Backendless::$Persistence->of("Job_group_main")->find($query)->getAsObjects();
// Ok above

$result_collection = Backendless::$Persistence->of("Job_group_main")->find($query)->totalObjects();
// doesn't work, ERROR

$count = $result_collection.totalObjects();
$count = $result_collection->totalObjects();
$count = $result_collection.totalObjects;

Still can’t get it.

The actual code should be:

$count = Backendless::$Persistence->of("mytable")->find($query)->totalObjectsCount();

Works now.