3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(0,1,2,3,4,5,6,7,8,9); $maxtries = int(count($a)*(float(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 = 28
Branch analysis from position: 28
2 jumps found. (Code = 46) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 15
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
Branch analysis from position: 33
Branch analysis from position: 33
filename:       /in/3OcSq
function name:  (null)
number of ops:  39
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        INIT_FCALL_BY_NAME                                       'int'
          2        COUNT                                            ~4      !0
          3        INIT_FCALL_BY_NAME                                       'float'
          4        COUNT                                            ~5      !0
          5        ADD                                              ~6      ~5, 1
          6        SEND_VAL_EX                                              ~6
          7        DO_FCALL                                      0  $7      
          8        DIV                                              ~8      $7, 2
          9        MUL                                              ~9      ~4, ~8
         10        SEND_VAL_EX                                              ~9
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !1, $10
    6    13        ASSIGN                                                   !2, 0
    7    14      > JMP                                                      ->28
    8    15    >   ROPE_INIT                                     3  ~14     'Try+number%3A+'
         16        ROPE_ADD                                      1  ~14     ~14, !2
         17        ROPE_END                                      2  ~13     ~14, '%0A'
         18        ECHO                                                     ~13
    9    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
   10    22        INIT_FCALL                                               'array_push'
         23        FETCH_DIM_W                                      $17     !0, !2
         24        SEND_REF                                                 $17
         25        DO_ICALL                                                 
   11    26        UNSET_DIM                                                !0, !2
   12    27        ASSIGN_OP                                     1          !2, 1
    7    28    >   ISSET_ISEMPTY_CV                                 ~20     !0
         29        BOOL_NOT                                         ~21     ~20
         30      > JMPZ_EX                                          ~21     ~21, ->33
         31    >   IS_SMALLER                                       ~22     !2, !1
         32        BOOL                                             ~21     ~22
         33    > > JMPNZ                                                    ~21, ->15
   14    34    >   ECHO                                                     'done%0A'
   15    35        INIT_FCALL                                               'print_r'
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.63 ms | 1396 KiB | 17 Q