3v4l.org

run code in 300+ PHP versions simultaneously
<?php $price = 0.70 + 0.10; //0.80 expected print_r(0.1 * intval(10 * $price)); //0.7 echo "\n"; $newPrice = substr(sprintf('%0.2f',$price),0,-1); print_r($newPrice); //0.8
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hFjDL
function name:  (null)
number of ops:  22
compiled vars:  !0 = $price, !1 = $newPrice
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 0.8
    4     1        INIT_FCALL                                               'print_r'
          2        MUL                                              ~3      !0, 10
          3        CAST                                          4  ~4      ~3
          4        MUL                                              ~5      ~4, 0.1
          5        SEND_VAL                                                 ~5
          6        DO_ICALL                                                 
    5     7        ECHO                                                     '%0A'
    7     8        INIT_FCALL                                               'substr'
          9        INIT_FCALL                                               'sprintf'
         10        SEND_VAL                                                 '%250.2f'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $7      
         13        SEND_VAR                                                 $7
         14        SEND_VAL                                                 0
         15        SEND_VAL                                                 -1
         16        DO_ICALL                                         $8      
         17        ASSIGN                                                   !1, $8
    8    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
208.25 ms | 1003 KiB | 16 Q