title: php create array with my sqli query and not array of objects
body: <p>I'm trying to make an array with the result of a mysql query but instead I'm making an array of objects. </p>
  
  <p>Have unsuccessfully tried to convert the array of objects into an array, is that the best approach?  </p>
  
  <pre><code>echo json_decode(json_encode($iconsArray), true); // didnt work
  </code></pre>
  
  <p>This is my query</p>
  
  <pre><code>function listIcons(){
    global $link;
    $queryAssets = "SELECT DISTINCT icon_1,icon_2,icon_3,icon_4 FROM icons";
    $resultqueryAssets = mysqli_query($link, $queryAssets) or 
    die(mysqli_error($link));
  
    while ($row = mysqli_fetch_assoc($resultqueryAssets)) {
  
      $iconsArray[] = $row;
    }
  
    $allIcons = json_encode($iconsArray);
    echo $allIcons;
    return array($allIcons);
  }
  </code></pre>
  
  <p>allIcons outout is</p>
  
  <pre><code>$allIcons = [
    0:{icon_1: "01_a", icon_2: "01_b", icon_3: "01_c", icon_4: "01_d"}
    1{icon_1: "02_a", icon_2: "02_b", icon_3: "02_c", icon_4: "02_d"}
  ]
  </code></pre>
  
  <p>And the output that I need but cant achieve</p>
  
  <pre><code>$allIcons = [
    0:"01_a"
    1:"02_a"
    2:"01_b"
    3:"02_b"
    4:"03_a"
    5:"02_b"
    ...
  ]
  </code></pre>