3v4l.org

run code in 300+ PHP versions simultaneously
<?php $countries = array ( 'London' => 'Europe/London', 'Istanbul' => 'Europe/Istanbul', 'Rome' => 'Europe/Rome', 'Berlin' => 'Europe/Berlin', 'Athens' => 'Europe/Athens', ); $offsets = array(); // initialize foreach($countries as $key => $country_offset) { // grouping $offset = timezone_offset_get( new DateTimeZone( $country_offset ), new DateTime() ); $offsets[$offset][] = array( 'name' => $key, 'offset' => $offset, 'timezome' => $country_offset, ); } ksort($offsets); // sort // presentation foreach($offsets as $offset => $info) { echo $offset . ' - '; $temp = array(); foreach($info as $t) { $temp[] = $t['name']; } echo implode(', ', $temp), "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 22
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 22
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 22
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 46
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 46
Branch analysis from position: 28
2 jumps found. (Code = 77) Position 1 = 33, Position 2 = 38
Branch analysis from position: 33
2 jumps found. (Code = 78) Position 1 = 34, Position 2 = 38
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 38
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
Branch analysis from position: 22
filename:       /in/OChWi
function name:  (null)
number of ops:  48
compiled vars:  !0 = $countries, !1 = $offsets, !2 = $country_offset, !3 = $key, !4 = $offset, !5 = $info, !6 = $temp, !7 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, <array>
   13     2      > FE_RESET_R                                       $10     !0, ->22
          3    > > FE_FETCH_R                                       ~11     $10, !2, ->22
          4    >   ASSIGN                                                   !3, ~11
   14     5        INIT_FCALL                                               'timezone_offset_get'
          6        NEW                                              $13     'DateTimeZone'
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0          
          9        SEND_VAR                                                 $13
         10        NEW                                              $15     'DateTime'
         11        DO_FCALL                                      0          
         12        SEND_VAR                                                 $15
         13        DO_ICALL                                         $17     
         14        ASSIGN                                                   !4, $17
   16    15        INIT_ARRAY                                       ~21     !3, 'name'
   17    16        ADD_ARRAY_ELEMENT                                ~21     !4, 'offset'
   18    17        ADD_ARRAY_ELEMENT                                ~21     !2, 'timezome'
   15    18        FETCH_DIM_W                                      $19     !1, !4
         19        ASSIGN_DIM                                               $19
   18    20        OP_DATA                                                  ~21
   13    21      > JMP                                                      ->3
         22    >   FE_FREE                                                  $10
   21    23        INIT_FCALL                                               'ksort'
         24        SEND_REF                                                 !1
         25        DO_ICALL                                                 
   23    26      > FE_RESET_R                                       $23     !1, ->46
         27    > > FE_FETCH_R                                       ~24     $23, !5, ->46
         28    >   ASSIGN                                                   !4, ~24
   24    29        CONCAT                                           ~26     !4, '+-+'
         30        ECHO                                                     ~26
   25    31        ASSIGN                                                   !6, <array>
   26    32      > FE_RESET_R                                       $28     !5, ->38
         33    > > FE_FETCH_R                                               $28, !7, ->38
   27    34    >   FETCH_DIM_R                                      ~30     !7, 'name'
         35        ASSIGN_DIM                                               !6
         36        OP_DATA                                                  ~30
   26    37      > JMP                                                      ->33
         38    >   FE_FREE                                                  $28
   29    39        INIT_FCALL                                               'implode'
         40        SEND_VAL                                                 '%2C+'
         41        SEND_VAR                                                 !6
         42        DO_ICALL                                         $31     
         43        ECHO                                                     $31
         44        ECHO                                                     '%0A'
   23    45      > JMP                                                      ->27
         46    >   FE_FREE                                                  $23
   30    47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.83 ms | 1400 KiB | 19 Q