3v4l.org

run code in 300+ PHP versions simultaneously
<?php $minimum = 0.25; $step = 0.1; $tests = [0.75, 0.76, 0.80, 0.85]; foreach ($tests as $original) { $new = $original + ($step - fmod($original - $minimum, $step)); echo $original, ' => ', $new, PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 18
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/W4JGr
function name:  (null)
number of ops:  20
compiled vars:  !0 = $minimum, !1 = $step, !2 = $tests, !3 = $original, !4 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 0.25
    4     1        ASSIGN                                                   !1, 0.1
    6     2        ASSIGN                                                   !2, <array>
    8     3      > FE_RESET_R                                       $8      !2, ->18
          4    > > FE_FETCH_R                                               $8, !3, ->18
    9     5    >   INIT_FCALL                                               'fmod'
          6        SUB                                              ~9      !3, !0
          7        SEND_VAL                                                 ~9
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $10     
         10        SUB                                              ~11     !1, $10
         11        ADD                                              ~12     !3, ~11
         12        ASSIGN                                                   !4, ~12
   10    13        ECHO                                                     !3
         14        ECHO                                                     '+%3D%3E+'
         15        ECHO                                                     !4
         16        ECHO                                                     '%0A'
    8    17      > JMP                                                      ->4
         18    >   FE_FREE                                                  $8
   11    19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.96 ms | 1010 KiB | 14 Q