3v4l.org

run code in 500+ PHP versions simultaneously
<?php function roundUp($number){ $int = floor($number); $float = $number-$int; if ($float*10 < 2.5) $result = $int; else $result = ceil($number); $result+= 0.25; echo $number." becomes ".$result."\n"; } roundUp(25.50); roundUp(25.10);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nsu60
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                                   'roundup'
          1        SEND_VAL                                                     25.5
          2        DO_FCALL                                          0          
   15     3        INIT_FCALL                                                   'roundup'
          4        SEND_VAL                                                     25.1
          5        DO_FCALL                                          0          
          6      > RETURN                                                       1

Function roundup:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nsu60
function name:  roundUp
number of ops:  22
compiled vars:  !0 = $number, !1 = $int, !2 = $float, !3 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        INIT_FCALL                                                   'floor'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $4      
          4        ASSIGN                                                       !1, $4
    5     5        SUB                                                  ~6      !0, !1
          6        ASSIGN                                                       !2, ~6
    6     7        MUL                                                  ~8      !2, 10
          8        IS_SMALLER                                                   ~8, 2.5
          9      > JMPZ                                                         ~9, ->12
    7    10    >   ASSIGN                                                       !3, !1
    6    11      > JMP                                                          ->16
    9    12    >   INIT_FCALL                                                   'ceil'
         13        SEND_VAR                                                     !0
         14        DO_ICALL                                             $11     
         15        ASSIGN                                                       !3, $11
   10    16    >   ASSIGN_OP                                         1          !3, 0.25
   11    17        CONCAT                                               ~14     !0, '+becomes+'
         18        CONCAT                                               ~15     ~14, !3
         19        CONCAT                                               ~16     ~15, '%0A'
         20        ECHO                                                         ~16
   12    21      > RETURN                                                       null

End of function roundup

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.42 ms | 2002 KiB | 17 Q