3v4l.org

run code in 300+ PHP versions simultaneously
<?php $price = '105,15'; $part = 0; var_dump(round(10.999, 2)); function decimalPart($price) { $price = (float)str_replace(',', '.', $price); return round($price - (int)$price, 2) * 100; } var_dump(decimalPart($price));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OMoB0
function name:  (null)
number of ops:  16
compiled vars:  !0 = $price, !1 = $part
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '105%2C15'
    4     1        ASSIGN                                                   !1, 0
    6     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'round'
          4        SEND_VAL                                                 10.999
          5        SEND_VAL                                                 2
          6        DO_ICALL                                         $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   16     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'decimalpart'
         11        SEND_VAR                                                 !0
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function decimalpart:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OMoB0
function name:  decimalPart
number of ops:  17
compiled vars:  !0 = $price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 '%2C'
          3        SEND_VAL                                                 '.'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6        CAST                                          5  ~2      $1
          7        ASSIGN                                                   !0, ~2
   13     8        INIT_FCALL                                               'round'
          9        CAST                                          4  ~4      !0
         10        SUB                                              ~5      !0, ~4
         11        SEND_VAL                                                 ~5
         12        SEND_VAL                                                 2
         13        DO_ICALL                                         $6      
         14        MUL                                              ~7      $6, 100
         15      > RETURN                                                   ~7
   14    16*     > RETURN                                                   null

End of function decimalpart

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.19 ms | 1399 KiB | 20 Q