3v4l.org

run code in 300+ PHP versions simultaneously
<?php $price = '105,15'; $part = 0; function decimalPart($price) { $price = str_replace(',', '.', $price); $price = round($price, 2); return round($price - (int)$price, 2); } var_dump(decimalPart($price));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q9HYn
function name:  (null)
number of ops:  9
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
   14     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'decimalpart'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

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

End of function decimalpart

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.2 ms | 1399 KiB | 20 Q