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 = 25
Branch analysis from position: 25
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 11
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
Branch analysis from position: 30
Branch analysis from position: 30
filename:       /in/P2WFQ
function name:  (null)
number of ops:  36
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                                                      ->25
    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                                                 
   11    18        INIT_FCALL                                               'array_push'
         19        SEND_REF                                                 !0
         20        FETCH_DIM_R                                      ~17     !0, !2
         21        SEND_VAL                                                 ~17
         22        DO_ICALL                                                 
   13    23        UNSET_DIM                                                !0, !2
   14    24        ASSIGN_OP                                     1          !2, 1
    7    25    >   ISSET_ISEMPTY_CV                                 ~20     !0
         26        BOOL_NOT                                         ~21     ~20
         27      > JMPZ_EX                                          ~21     ~21, ->30
         28    >   IS_SMALLER                                       ~22     !2, !1
         29        BOOL                                             ~21     ~22
         30    > > JMPNZ                                                    ~21, ->11
   16    31    >   ECHO                                                     'done%0A'
   17    32        INIT_FCALL                                               'print_r'
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.12 ms | 1388 KiB | 17 Q