3v4l.org

run code in 300+ PHP versions simultaneously
<?php $factor=6; for($x=0; $x<10; ++$x){ // battery of 10 tests $number=rand(0,100); echo "Number: $number Becomes: "; if($remainder=$number%$factor){ // if not zero $number+=$factor-$remainder; // use cached $remainder instead of calculating again } echo "$number\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 3
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 3
Branch analysis from position: 23
Branch analysis from position: 3
Branch analysis from position: 17
filename:       /in/irtEn
function name:  (null)
number of ops:  24
compiled vars:  !0 = $factor, !1 = $x, !2 = $number, !3 = $remainder
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 6
    3     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->21
    4     3    >   INIT_FCALL                                               'rand'
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 100
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !2, $6
    5     8        ROPE_INIT                                     3  ~9      'Number%3A+'
          9        ROPE_ADD                                      1  ~9      ~9, !2
         10        ROPE_END                                      2  ~8      ~9, '+Becomes%3A+'
         11        ECHO                                                     ~8
    6    12        MOD                                              ~11     !2, !0
         13        ASSIGN                                           ~12     !3, ~11
         14      > JMPZ                                                     ~12, ->17
    7    15    >   SUB                                              ~13     !0, !3
         16        ASSIGN_OP                                     1          !2, ~13
    9    17    >   NOP                                                      
         18        FAST_CONCAT                                      ~15     !2, '%0A'
         19        ECHO                                                     ~15
    3    20        PRE_INC                                                  !1
         21    >   IS_SMALLER                                               !1, 10
         22      > JMPNZ                                                    ~17, ->3
   10    23    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.71 ms | 1451 KiB | 14 Q