Q:

How can I count the values in an array?

I have attempted to print all the values of my array, however I cannot seem to get the total count of the array. I've tried count(), sizeOf() and array_count_values but neither of these functions seems to do the job.
$query = DB::getInstance()->query("SELECT orderStatus FROM customerOrders");                

foreach ($query->results() as $orderered) {

   $result_array = array($orderered);
 //print_r($result_array);

  $orderData = array_map(function ($object) { return $object->orderStatus; }, $result_array);

  $test = json_decode(json_encode($result_array), true);

  $ORvalue = serialize($test);

  $ORvalue2 = unserialize($ORvalue);

  $orderValueNEW = call_user_func_array('array_merge', $ORvalue2);

  print_r($orderValueNEW);//debug 

 }//close foreach loop

Results of the array after printing:
Array ( [orderStatus] => 0 ) 
Array ( [orderStatus] => 0 ) 
Array ( [orderStatus] => 0 ) 
Array ( [orderStatus] => 1 ) 
Array ( [orderStatus] => 1 ) 

After performing count() and sizeOf:
11111 

After running array_count_values:
echo (array_count_values($orderValueNEW));
ArrayArrayArrayArrayArray 

A:

The count function would certainly work here:
$results = $query->results();

$num = count($values);

foreach($results as $ordered) { // etc. 

