3v4l.org

run code in 300+ PHP versions simultaneously
<?php $locations = Array( Array ( 'id' => 14, 'post_id' => 319, 'location' => 'Atlanta, GA', 'address' => '161 Racetrack Rd., McDonough', 'city' => 'Atlanta', 'state' => 'Georgia', 'state_code' =>'GA', 'country' => 'USA', 'zipcode' => 30253, 'service_zipcode' => '', 'phone' => '', 'fax' => '', 'email' => '', 'facebook' => '', 'twitter' => '', 'linkedin' => '', 'gplus' => '', 'latitude' => '', 'longitude' => '', 'url' => '', 'created_at' => '2019-04-22 07:22:55', 'updated_at' => '2019-04-22 07:26:31', ), Array ( 'id' => 16, 'post_id' => 321, 'location' => 'Augusta, Georigia', 'address' => '1446 Harper Street', 'city' => 'Augusta', 'state' => 'Georigia', 'state_code' => 'GA', 'country' => 'USA', 'zipcode' => '', 'service_zipcode' => '', 'phone' => '', 'fax' => '', 'email' => '', 'facebook' => '', 'twitter' => '', 'linkedin' => '', 'gplus' => '', 'latitude' => '', 'longitude' => '', 'url' => '', 'created_at' => '2019-04-22 07:29:33', 'updated_at' => '2019-04-22 07:32:25', ), Array ( 'id' => 12, 'post_id' => 317, 'location' => 'Savannah, Georgia', 'address' => '834 Northside Dr. East, Statesboro', 'city' => 'Savannah', 'state' => 'Georgia', 'state_code' => 'GA', 'country' => 'USA', 'zipcode' => 30458, 'service_zipcode' => '', 'phone' => '', 'fax' => '', 'email' => '', 'facebook' => '', 'twitter' => '', 'linkedin' => '', 'gplus' => '', 'latitude' => '', 'longitude' => '', 'url' => '', 'created_at' => '2019-04-22 07:15:43', 'updated_at' => '2019-04-22 07:18:11', ) ); $hierarchy = []; if (! empty($locations)) { foreach ($locations as $location) { $hierarchy[$location['country']][$location['state']] = $location; } } if (! empty($hierarchy)) { foreach ($hierarchy as $country => $location) { echo "<br/>" . $country; if (! empty($hierarchy[$country])) { foreach ($hierarchy[$country] as $state => $city) { echo "<br/>--> " . $state; echo "<br/>----> " . $city['city']; } } } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 14
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 38
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 37
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 37
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 36
Branch analysis from position: 25
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 35
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 35
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 35
Branch analysis from position: 36
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
Branch analysis from position: 38
Branch analysis from position: 13
Branch analysis from position: 14
filename:       /in/hVNWo
function name:  (null)
number of ops:  39
compiled vars:  !0 = $locations, !1 = $hierarchy, !2 = $location, !3 = $country, !4 = $city, !5 = $state
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   80     1        ASSIGN                                                   !1, <array>
   81     2        ISSET_ISEMPTY_CV                                 ~8      !0
          3        BOOL_NOT                                         ~9      ~8
          4      > JMPZ                                                     ~9, ->14
   82     5    > > FE_RESET_R                                       $10     !0, ->13
          6    > > FE_FETCH_R                                               $10, !2, ->13
   83     7    >   FETCH_DIM_R                                      ~11     !2, 'country'
          8        FETCH_DIM_R                                      ~13     !2, 'state'
          9        FETCH_DIM_W                                      $12     !1, ~11
         10        ASSIGN_DIM                                               $12, ~13
         11        OP_DATA                                                  !2
   82    12      > JMP                                                      ->6
         13    >   FE_FREE                                                  $10
   87    14    >   ISSET_ISEMPTY_CV                                 ~15     !1
         15        BOOL_NOT                                         ~16     ~15
         16      > JMPZ                                                     ~16, ->38
   88    17    > > FE_RESET_R                                       $17     !1, ->37
         18    > > FE_FETCH_R                                       ~18     $17, !2, ->37
         19    >   ASSIGN                                                   !3, ~18
   89    20        CONCAT                                           ~20     '%3Cbr%2F%3E', !3
         21        ECHO                                                     ~20
   90    22        ISSET_ISEMPTY_DIM_OBJ                         1  ~21     !1, !3
         23        BOOL_NOT                                         ~22     ~21
         24      > JMPZ                                                     ~22, ->36
   91    25    >   FETCH_DIM_R                                      ~23     !1, !3
         26      > FE_RESET_R                                       $24     ~23, ->35
         27    > > FE_FETCH_R                                       ~25     $24, !4, ->35
         28    >   ASSIGN                                                   !5, ~25
   92    29        CONCAT                                           ~27     '%3Cbr%2F%3E--%3E+', !5
         30        ECHO                                                     ~27
   93    31        FETCH_DIM_R                                      ~28     !4, 'city'
         32        CONCAT                                           ~29     '%3Cbr%2F%3E----%3E+', ~28
         33        ECHO                                                     ~29
   91    34      > JMP                                                      ->27
         35    >   FE_FREE                                                  $24
   88    36    > > JMP                                                      ->18
         37    >   FE_FREE                                                  $17
   97    38    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.17 ms | 1403 KiB | 13 Q