fork(2) download
  1. <?php
  2.  
  3. $results = [
  4. ['id' => 1, 'breakdown' => [1, 2]],
  5. ['id' => 2, 'breakdown' => [5, 6]],
  6. ['id' => 3, 'breakdown' => [7]],
  7. ];
  8.  
  9. $extraAccessorials = [9];
  10.  
  11. foreach ($results as $key => $value) {
  12. $results[$key]['breakdown'] = \array_merge($results[$key]['breakdown'], $extraAccessorials);
  13. }
  14.  
  15. var_dump($results);exit;
  16.  
Success #stdin #stdout 0s 82560KB
stdin
Standard input is empty
stdout
array(3) {
  [0]=>
  array(2) {
    ["id"]=>
    int(1)
    ["breakdown"]=>
    array(3) {
      [0]=>
      int(1)
      [1]=>
      int(2)
      [2]=>
      int(9)
    }
  }
  [1]=>
  array(2) {
    ["id"]=>
    int(2)
    ["breakdown"]=>
    array(3) {
      [0]=>
      int(5)
      [1]=>
      int(6)
      [2]=>
      int(9)
    }
  }
  [2]=>
  array(2) {
    ["id"]=>
    int(3)
    ["breakdown"]=>
    array(2) {
      [0]=>
      int(7)
      [1]=>
      int(9)
    }
  }
}