3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(0,1,2); $maxtries = intval(count($a)*(floatval(count($a)+1)/2.0)); $tries = 0; while(!empty($a) && $tries<$maxtries) { echo "Try number: ".($tries+1)."\n"; print_r($a); if($a[$tries]<$a[$tries+1]) { array_push($a, $a[$tries]); } unset($a[$tries]); $tries += 1; } echo "done\n"; print_r($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 46) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 11
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 28
Branch analysis from position: 23
2 jumps found. (Code = 46) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
Branch analysis from position: 35
Branch analysis from position: 28
Branch analysis from position: 35
filename:       /in/sQXum
function name:  (null)
number of ops:  41
compiled vars:  !0 = $a, !1 = $maxtries, !2 = $tries
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        COUNT                                            ~4      !0
          2        COUNT                                            ~5      !0
          3        ADD                                              ~6      ~5, 1
          4        CAST                                          5  ~7      ~6
          5        DIV                                              ~8      ~7, 2
          6        MUL                                              ~9      ~4, ~8
          7        CAST                                          4  ~10     ~9
          8        ASSIGN                                                   !1, ~10
    6     9        ASSIGN                                                   !2, 0
    7    10      > JMP                                                      ->30
    8    11    >   ADD                                              ~13     !2, 1
         12        CONCAT                                           ~14     'Try+number%3A+', ~13
         13        CONCAT                                           ~15     ~14, '%0A'
         14        ECHO                                                     ~15
    9    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
   10    18        FETCH_DIM_R                                      ~17     !0, !2
         19        ADD                                              ~18     !2, 1
         20        FETCH_DIM_R                                      ~19     !0, ~18
         21        IS_SMALLER                                               ~17, ~19
         22      > JMPZ                                                     ~20, ->28
   11    23    >   INIT_FCALL                                               'array_push'
         24        SEND_REF                                                 !0
         25        FETCH_DIM_R                                      ~21     !0, !2
         26        SEND_VAL                                                 ~21
         27        DO_ICALL                                                 
   13    28    >   UNSET_DIM                                                !0, !2
   14    29        ASSIGN_OP                                     1          !2, 1
    7    30    >   ISSET_ISEMPTY_CV                                 ~24     !0
         31        BOOL_NOT                                         ~25     ~24
         32      > JMPZ_EX                                          ~25     ~25, ->35
         33    >   IS_SMALLER                                       ~26     !2, !1
         34        BOOL                                             ~25     ~26
         35    > > JMPNZ                                                    ~25, ->11
   16    36    >   ECHO                                                     'done%0A'
   17    37        INIT_FCALL                                               'print_r'
         38        SEND_VAR                                                 !0
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.57 ms | 1400 KiB | 17 Q