how to move array inside array and convert single array PHP

  arrays, foreach, php

I am getting array inside array but i want to convert
this into single array,how can i do this ? Here is my current code

    $array = $query->result_array(); // array inside array
        $result = array(); 
      foreach ($array as $key => $value) { 
        if (is_array($value)) { 
          $result = array_merge($result, $array); 
        } 
        
      } 

print_r($result);

Above code giving me following output

Array
(
    [0] => Array
        (
            [id] => 1
            [ques_id] => 1
            [parentBusinessId] => 0
            [businessId] => 1
            [avg_rating] => 4
        )

    [1] => Array
        (
            [id] => 3
            [ques_id] => 2
            [parentBusinessId] => 0
            [businessId] => 1
            [avg_rating] => 4.5
        )
...

How can i remove 0 and 1 ( How can i put this into single array)

Source: Ask PHP

LEAVE A COMMENT