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))+1; $tries = 0; while(!empty($a) && $tries<$maxtries) { echo "Try number: ".($tries+1)."\n"; print_r($a); if($a[$tries]==0 || $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 = 35
Branch analysis from position: 35
2 jumps found. (Code = 46) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 12
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 47) Position 1 = 22, Position 2 = 27
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 33
Branch analysis from position: 28
2 jumps found. (Code = 46) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
Branch analysis from position: 40
Branch analysis from position: 33
Branch analysis from position: 27
Branch analysis from position: 40
filename:       /in/vvuMO
function name:  (null)
number of ops:  46
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        ADD                                              ~11     ~10, 1
          9        ASSIGN                                                   !1, ~11
    6    10        ASSIGN                                                   !2, 0
    7    11      > JMP                                                      ->35
    8    12    >   ADD                                              ~14     !2, 1
         13        CONCAT                                           ~15     'Try+number%3A+', ~14
         14        CONCAT                                           ~16     ~15, '%0A'
         15        ECHO                                                     ~16
    9    16        INIT_FCALL                                               'print_r'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
   10    19        FETCH_DIM_R                                      ~18     !0, !2
         20        IS_EQUAL                                         ~19     ~18, 0
         21      > JMPNZ_EX                                         ~19     ~19, ->27
         22    >   FETCH_DIM_R                                      ~20     !0, !2
         23        ADD                                              ~21     !2, 1
         24        FETCH_DIM_R                                      ~22     !0, ~21
         25        IS_SMALLER                                       ~23     ~20, ~22
         26        BOOL                                             ~19     ~23
         27    > > JMPZ                                                     ~19, ->33
   11    28    >   INIT_FCALL                                               'array_push'
         29        SEND_REF                                                 !0
         30        FETCH_DIM_R                                      ~24     !0, !2
         31        SEND_VAL                                                 ~24
         32        DO_ICALL                                                 
   13    33    >   UNSET_DIM                                                !0, !2
   14    34        ASSIGN_OP                                     1          !2, 1
    7    35    >   ISSET_ISEMPTY_CV                                 ~27     !0
         36        BOOL_NOT                                         ~28     ~27
         37      > JMPZ_EX                                          ~28     ~28, ->40
         38    >   IS_SMALLER                                       ~29     !2, !1
         39        BOOL                                             ~28     ~29
         40    > > JMPNZ                                                    ~28, ->12
   16    41    >   ECHO                                                     'done%0A'
   17    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:
151.61 ms | 1400 KiB | 17 Q