How can I simplify this code as a loop? Do i need to use a foreach
loop inside the loop too?
foreach ($data as $item) {
$a = new stdClass;
$a->v = $item->location_name;
$a->f = null;
$b = new stdClass;
$b->v = intval($item->count);
$b->f = null;
$c = new stdClass;
$c->c = array($a, $b);
$rows[] = $c;
}