3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = []; for ($i=0;$i<10;$i++){$arr[] = random_int(0,100);} echo "Start Array: \n";print_r($arr); echo "Sorted: \n"; foreach ($arr as $i => $val1) foreach ($arr as $j => $val2) if ($arr[$i] < $arr[$j]) [$arr[$i], $arr[$j]] = [$arr[$j], $arr[$i]]; print_r($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 3
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 41
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 41
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 39
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 39
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 38
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 38
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 39
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 3
Branch analysis from position: 12
Branch analysis from position: 3
filename:       /in/Qi2WH
function name:  (null)
number of ops:  46
compiled vars:  !0 = $arr, !1 = $i, !2 = $val1, !3 = $val2, !4 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->10
          3    >   INIT_FCALL                                               'random_int'
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 100
          6        DO_ICALL                                         $8      
          7        ASSIGN_DIM                                               !0
          8        OP_DATA                                                  $8
          9        PRE_INC                                                  !1
         10    >   IS_SMALLER                                               !1, 10
         11      > JMPNZ                                                    ~10, ->3
    6    12    >   ECHO                                                     'Start+Array%3A+%0A'
         13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
    8    16        ECHO                                                     'Sorted%3A+%0A'
   10    17      > FE_RESET_R                                       $12     !0, ->41
         18    > > FE_FETCH_R                                       ~13     $12, !2, ->41
         19    >   ASSIGN                                                   !1, ~13
   11    20      > FE_RESET_R                                       $15     !0, ->39
         21    > > FE_FETCH_R                                       ~16     $15, !3, ->39
         22    >   ASSIGN                                                   !4, ~16
   12    23        FETCH_DIM_R                                      ~18     !0, !1
         24        FETCH_DIM_R                                      ~19     !0, !4
         25        IS_SMALLER                                               ~18, ~19
         26      > JMPZ                                                     ~20, ->38
   13    27    >   FETCH_DIM_R                                      ~21     !0, !4
         28        INIT_ARRAY                                       ~22     ~21
         29        FETCH_DIM_R                                      ~23     !0, !1
         30        ADD_ARRAY_ELEMENT                                ~22     ~23
         31        FETCH_LIST_R                                     $24     ~22, 0
         32        ASSIGN_DIM                                               !0, !1
         33        OP_DATA                                                  $24
         34        FETCH_LIST_R                                     $26     ~22, 1
         35        ASSIGN_DIM                                               !0, !4
         36        OP_DATA                                                  $26
         37        FREE                                                     ~22
   11    38    > > JMP                                                      ->21
         39    >   FE_FREE                                                  $15
   10    40      > JMP                                                      ->18
         41    >   FE_FREE                                                  $12
   15    42        INIT_FCALL                                               'print_r'
         43        SEND_VAR                                                 !0
         44        DO_ICALL                                                 
         45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.71 ms | 1405 KiB | 17 Q