3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( Array ( "0" => "sue", "1" => "salem", "2" => 30 ), Array ( "0" => "bob", "1" => "salem", "2" => 10 ), Array ( "0" => "sue", "1" => "benton", "2" => 2 ), Array ( "0" => "bob", "1" => "benton", "2" => 30 )); $keys = ["name", "locn", "sales"]; Foreach($arr as &$subarr){ $res[$subarr[1]][] = array_combine($keys, $subarr); } $prev_city =""; foreach($res as $city => $sales_array){ echo 'LOCN: ' . $city . " <br>\n"; foreach($sales_array as $sales){ echo ' NAME: ' . $sales['name'] . ' - ' . $sales['sales'] . " <br>\n"; } echo "<br>\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 34
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 34
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 31
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 31
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 31
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
Branch analysis from position: 13
filename:       /in/Y6OKk
function name:  (null)
number of ops:  36
compiled vars:  !0 = $arr, !1 = $keys, !2 = $subarr, !3 = $res, !4 = $prev_city, !5 = $sales_array, !6 = $city, !7 = $sales
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   28     1        ASSIGN                                                   !1, <array>
   29     2      > FE_RESET_RW                                      $10     !0, ->13
          3    > > FE_FETCH_RW                                              $10, !2, ->13
   30     4    >   FETCH_DIM_R                                      ~11     !2, 1
          5        INIT_FCALL                                               'array_combine'
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $14     
          9        FETCH_DIM_W                                      $12     !3, ~11
         10        ASSIGN_DIM                                               $12
         11        OP_DATA                                                  $14
   29    12      > JMP                                                      ->3
         13    >   FE_FREE                                                  $10
   32    14        ASSIGN                                                   !4, ''
   33    15      > FE_RESET_R                                       $16     !3, ->34
         16    > > FE_FETCH_R                                       ~17     $16, !5, ->34
         17    >   ASSIGN                                                   !6, ~17
   34    18        CONCAT                                           ~19     'LOCN%3A+', !6
         19        CONCAT                                           ~20     ~19, '+%3Cbr%3E%0A'
         20        ECHO                                                     ~20
   35    21      > FE_RESET_R                                       $21     !5, ->31
         22    > > FE_FETCH_R                                               $21, !7, ->31
   36    23    >   FETCH_DIM_R                                      ~22     !7, 'name'
         24        CONCAT                                           ~23     '+NAME%3A+', ~22
         25        CONCAT                                           ~24     ~23, '+-+'
         26        FETCH_DIM_R                                      ~25     !7, 'sales'
         27        CONCAT                                           ~26     ~24, ~25
         28        CONCAT                                           ~27     ~26, '+%3Cbr%3E%0A'
         29        ECHO                                                     ~27
   35    30      > JMP                                                      ->22
         31    >   FE_FREE                                                  $21
   38    32        ECHO                                                     '%3Cbr%3E%0A'
   33    33      > JMP                                                      ->16
         34    >   FE_FREE                                                  $16
   40    35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.89 ms | 1015 KiB | 14 Q