Hitung objek php

$total = count((array)$obj);
Shadow