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' => 16, 'post_id' => 321, 'location' => 'Augusta, Georigia', 'address' => '1446 Harper Street', 'city' => 'Huston', 'state' => 'Texas', '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', ) ); $arr = array_column($locations, "state", "city"); asort($arr); $prev = null; foreach($arr as $city => $state){ if($state != $prev){ echo PHP_EOL . PHP_EOL . $state . PHP_EOL; $prev = $state; } echo "---" . $city . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 24
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 24
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 20
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/gfcia
function name:  (null)
number of ops:  26
compiled vars:  !0 = $locations, !1 = $arr, !2 = $prev, !3 = $state, !4 = $city
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
  105     1        INIT_FCALL                                               'array_column'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'state'
          4        SEND_VAL                                                 'city'
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !1, $6
  106     7        INIT_FCALL                                               'asort'
          8        SEND_REF                                                 !1
          9        DO_ICALL                                                 
  107    10        ASSIGN                                                   !2, null
  109    11      > FE_RESET_R                                       $10     !1, ->24
         12    > > FE_FETCH_R                                       ~11     $10, !3, ->24
         13    >   ASSIGN                                                   !4, ~11
  110    14        IS_NOT_EQUAL                                             !3, !2
         15      > JMPZ                                                     ~13, ->20
  111    16    >   CONCAT                                           ~14     '%0A%0A', !3
         17        CONCAT                                           ~15     ~14, '%0A'
         18        ECHO                                                     ~15
  112    19        ASSIGN                                                   !2, !3
  114    20    >   CONCAT                                           ~17     '---', !4
         21        CONCAT                                           ~18     ~17, '%0A'
         22        ECHO                                                     ~18
  109    23      > JMP                                                      ->12
         24    >   FE_FREE                                                  $10
  115    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.67 ms | 1400 KiB | 17 Q