3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [-1 , -3,]; for ($i = 1; $i < count($arr); $i++) { $key = $arr[$i]; $j = $i - 1; // Move elements greater than key one position ahead while ($j >= 0 && $arr[$j] > $key) { $arr[$j + 1] = $arr[$j]; $j--; } // Insert key at correct position $arr[$j + 1] = $key; } print_r($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 3
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 8
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 3
Branch analysis from position: 26
Branch analysis from position: 3
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
Branch analysis from position: 18
Branch analysis from position: 18
filename:       /in/kvTXt
function name:  (null)
number of ops:  30
compiled vars:  !0 = $arr, !1 = $i, !2 = $key, !3 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, 1
          2      > JMP                                                      ->23
    6     3    >   FETCH_DIM_R                                      ~6      !0, !1
          4        ASSIGN                                                   !2, ~6
    7     5        SUB                                              ~8      !1, 1
          6        ASSIGN                                                   !3, ~8
   10     7      > JMP                                                      ->13
   11     8    >   ADD                                              ~10     !3, 1
          9        FETCH_DIM_R                                      ~12     !0, !3
         10        ASSIGN_DIM                                               !0, ~10
         11        OP_DATA                                                  ~12
   12    12        PRE_DEC                                                  !3
   10    13    >   IS_SMALLER_OR_EQUAL                              ~14     0, !3
         14      > JMPZ_EX                                          ~14     ~14, ->18
         15    >   FETCH_DIM_R                                      ~15     !0, !3
         16        IS_SMALLER                                       ~16     !2, ~15
         17        BOOL                                             ~14     ~16
         18    > > JMPNZ                                                    ~14, ->8
   16    19    >   ADD                                              ~17     !3, 1
         20        ASSIGN_DIM                                               !0, ~17
         21        OP_DATA                                                  !2
    5    22        PRE_INC                                                  !1
         23    >   COUNT                                            ~20     !0
         24        IS_SMALLER                                               !1, ~20
         25      > JMPNZ                                                    ~21, ->3
   19    26    >   INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.63 ms | 1014 KiB | 14 Q