Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, SBError given in

for ($i = 0; $i < count($orders); $i++) {
        $total += floatval($orders[$i]['price']);
        $orders[$i]['url'] = $url . '/admin/all_orders/' . sb_aecommerce_encrypt($orders[$i]['id']) . '/show';
    }

how can i solve this issue ?

i try to make the code like this but still not work

for ($i = 0; $i < count((array)$orders); $i++)
for ($i = 0; $i < count((array)$orders); $i++) {
        $total += floatval($orders[$i]['price']);
        $orders[$i]['url'] = $url . '/admin/all_orders/' . sb_aecommerce_encrypt($orders[$i]['id']) . '/show';
    }