3v4l.org

run code in 300+ PHP versions simultaneously
<?php $list = array( array(0 => "F"), array(1 => "E"), array(60 => "B"), array(20 => "C"), array(14 => "D"), array(100 => "A"), ); $tmp = []; for($x = 0; $x < sizeof($list); $x++) { for($i = 0; $i < sizeof($list); $i++) { if (!isset($list[$i + 1])) { continue; } $nextVal = key($list[$i + 1]); $currentVal = key($list[$i]); if ($nextVal > $currentVal) { [$list[$i], $list[$i + 1]] = [$list[$i + 1], $list[$i]]; } } } echo "AFTER:\n"; var_dump($list);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 4
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 6
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 4
Branch analysis from position: 45
Branch analysis from position: 4
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 6
Branch analysis from position: 41
Branch analysis from position: 6
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 37
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 6
Branch analysis from position: 41
Branch analysis from position: 6
Branch analysis from position: 37
filename:       /in/jQ64m
function name:  (null)
number of ops:  50
compiled vars:  !0 = $list, !1 = $tmp, !2 = $x, !3 = $i, !4 = $nextVal, !5 = $currentVal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, <array>
   15     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->42
   16     4    >   ASSIGN                                                   !3, 0
          5      > JMP                                                      ->38
   18     6    >   ADD                                              ~10     !3, 1
          7        ISSET_ISEMPTY_DIM_OBJ                         0  ~11     !0, ~10
          8        BOOL_NOT                                         ~12     ~11
          9      > JMPZ                                                     ~12, ->11
         10    > > JMP                                                      ->37
   20    11    >   INIT_FCALL                                               'key'
         12        ADD                                              ~13     !3, 1
         13        FETCH_DIM_R                                      ~14     !0, ~13
         14        SEND_VAL                                                 ~14
         15        DO_ICALL                                         $15     
         16        ASSIGN                                                   !4, $15
   21    17        INIT_FCALL                                               'key'
         18        FETCH_DIM_R                                      ~17     !0, !3
         19        SEND_VAL                                                 ~17
         20        DO_ICALL                                         $18     
         21        ASSIGN                                                   !5, $18
   23    22        IS_SMALLER                                               !5, !4
         23      > JMPZ                                                     ~20, ->37
   24    24    >   ADD                                              ~21     !3, 1
         25        FETCH_DIM_R                                      ~22     !0, ~21
         26        INIT_ARRAY                                       ~23     ~22
         27        FETCH_DIM_R                                      ~24     !0, !3
         28        ADD_ARRAY_ELEMENT                                ~23     ~24
         29        FETCH_LIST_R                                     $25     ~23, 0
         30        ASSIGN_DIM                                               !0, !3
         31        OP_DATA                                                  $25
         32        FETCH_LIST_R                                     $27     ~23, 1
         33        ADD                                              ~28     !3, 1
         34        ASSIGN_DIM                                               !0, ~28
         35        OP_DATA                                                  $27
         36        FREE                                                     ~23
   16    37    >   PRE_INC                                                  !3
         38    >   COUNT                                            ~31     !0
         39        IS_SMALLER                                               !3, ~31
         40      > JMPNZ                                                    ~32, ->6
   15    41    >   PRE_INC                                                  !2
         42    >   COUNT                                            ~34     !0
         43        IS_SMALLER                                               !2, ~34
         44      > JMPNZ                                                    ~35, ->4
   29    45    >   ECHO                                                     'AFTER%3A%0A'
   30    46        INIT_FCALL                                               'var_dump'
         47        SEND_VAR                                                 !0
         48        DO_ICALL                                                 
         49      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.97 ms | 1008 KiB | 15 Q