3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(0,1,2,3,4,5,6,7,8,9); $maxtries = intval(count($a)*(floatval(count($a)+1)/2.0)); $tries = 0; while(!empty($a) && $tries<$maxtries) { echo "Try number: $tries\n"; print_r($a); array_push($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 = 24
Branch analysis from position: 24
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 11
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
Branch analysis from position: 29
Branch analysis from position: 29
filename:       /in/6X1kb
function name:  (null)
number of ops:  35
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                                                      ->24
    8    11    >   ROPE_INIT                                     3  ~14     'Try+number%3A+'
         12        ROPE_ADD                                      1  ~14     ~14, !2
         13        ROPE_END                                      2  ~13     ~14, '%0A'
         14        ECHO                                                     ~13
    9    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
   10    18        INIT_FCALL                                               'array_push'
         19        FETCH_DIM_W                                      $17     !0, !2
         20        SEND_REF                                                 $17
         21        DO_ICALL                                                 
   11    22        UNSET_DIM                                                !0, !2
   12    23        ASSIGN_OP                                     1          !2, 1
    7    24    >   ISSET_ISEMPTY_CV                                 ~20     !0
         25        BOOL_NOT                                         ~21     ~20
         26      > JMPZ_EX                                          ~21     ~21, ->29
         27    >   IS_SMALLER                                       ~22     !2, !1
         28        BOOL                                             ~21     ~22
         29    > > JMPNZ                                                    ~21, ->11
   14    30    >   ECHO                                                     'done%0A'
   15    31        INIT_FCALL                                               'print_r'
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.01 ms | 1396 KiB | 17 Q