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) - $x - 1; $i++) { $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 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 4
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 6
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 4
Branch analysis from position: 42
Branch analysis from position: 4
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 32
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 6
Branch analysis from position: 38
Branch analysis from position: 6
Branch analysis from position: 32
filename:       /in/46ieJ
function name:  (null)
number of ops:  47
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                                                      ->39
   16     4    >   ASSIGN                                                   !3, 0
          5      > JMP                                                      ->33
   18     6    >   INIT_FCALL                                               'key'
          7        ADD                                              ~10     !3, 1
          8        FETCH_DIM_R                                      ~11     !0, ~10
          9        SEND_VAL                                                 ~11
         10        DO_ICALL                                         $12     
         11        ASSIGN                                                   !4, $12
   19    12        INIT_FCALL                                               'key'
         13        FETCH_DIM_R                                      ~14     !0, !3
         14        SEND_VAL                                                 ~14
         15        DO_ICALL                                         $15     
         16        ASSIGN                                                   !5, $15
   21    17        IS_SMALLER                                               !5, !4
         18      > JMPZ                                                     ~17, ->32
   22    19    >   ADD                                              ~18     !3, 1
         20        FETCH_DIM_R                                      ~19     !0, ~18
         21        INIT_ARRAY                                       ~20     ~19
         22        FETCH_DIM_R                                      ~21     !0, !3
         23        ADD_ARRAY_ELEMENT                                ~20     ~21
         24        FETCH_LIST_R                                     $22     ~20, 0
         25        ASSIGN_DIM                                               !0, !3
         26        OP_DATA                                                  $22
         27        FETCH_LIST_R                                     $24     ~20, 1
         28        ADD                                              ~25     !3, 1
         29        ASSIGN_DIM                                               !0, ~25
         30        OP_DATA                                                  $24
         31        FREE                                                     ~20
   16    32    >   PRE_INC                                                  !3
         33    >   COUNT                                            ~28     !0
         34        SUB                                              ~29     ~28, !2
         35        SUB                                              ~30     ~29, 1
         36        IS_SMALLER                                               !3, ~30
         37      > JMPNZ                                                    ~31, ->6
   15    38    >   PRE_INC                                                  !2
         39    >   COUNT                                            ~33     !0
         40        IS_SMALLER                                               !2, ~33
         41      > JMPNZ                                                    ~34, ->4
   27    42    >   ECHO                                                     'AFTER%3A%0A'
   28    43        INIT_FCALL                                               'var_dump'
         44        SEND_VAR                                                 !0
         45        DO_ICALL                                                 
         46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.83 ms | 1004 KiB | 15 Q