3v4l.org

run code in 500+ 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:  19
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                                                   'sprintf'
          9        SEND_VAL                                                     '%250.2f'
         10        SEND_VAR                                                     !0
         11        DO_ICALL                                             $7      
         12        FRAMELESS_ICALL_3                substr              ~8      $7, 0
         13        OP_DATA                                                      -1
         14        ASSIGN                                                       !1, ~8
    8    15        INIT_FCALL                                                   'print_r'
         16        SEND_VAR                                                     !1
         17        DO_ICALL                                                     
         18      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.68 ms | 1851 KiB | 15 Q