3v4l.org

run code in 300+ PHP versions simultaneously
<?php function twodecimals($number, $afterDot = 2){ return floor($number * pow(10, $afterDot) + 0.00001) / pow(10, $afterDot); } echo twodecimals(18.99);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XPc4f
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'twodecimals'
          1        SEND_VAL                                                 18.99
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function twodecimals:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XPc4f
function name:  twodecimals
number of ops:  18
compiled vars:  !0 = $number, !1 = $afterDot
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      2
    3     2        INIT_FCALL                                               'floor'
          3        INIT_FCALL                                               'pow'
          4        SEND_VAL                                                 10
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $2      
          7        MUL                                              ~3      !0, $2
          8        ADD                                              ~4      ~3, 1.0e-5
          9        SEND_VAL                                                 ~4
         10        DO_ICALL                                         $5      
         11        INIT_FCALL                                               'pow'
         12        SEND_VAL                                                 10
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $6      
         15        DIV                                              ~7      $5, $6
         16      > RETURN                                                   ~7
    4    17*     > RETURN                                                   null

End of function twodecimals

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.37 ms | 1398 KiB | 18 Q