3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rate1 = 0.02; $var = sprintf("%.2f",1260); //$var holds numeric string var_dump($var,"\n\n"); $var = 1260; $product = $var * $rate1; var_dump("product: $product\n"); // two ways to format $product echo number_format( $product, 2),"\n"; echo printf("%.2f",$product);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0YSh4
function name:  (null)
number of ops:  31
compiled vars:  !0 = $rate1, !1 = $var, !2 = $product
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 0.02
    4     1        INIT_FCALL                                               'sprintf'
          2        SEND_VAL                                                 '%25.2f'
          3        SEND_VAL                                                 1260
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    5     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        SEND_VAL                                                 '%0A%0A'
          9        DO_ICALL                                                 
    7    10        ASSIGN                                                   !1, 1260
    9    11        MUL                                              ~8      !1, !0
         12        ASSIGN                                                   !2, ~8
   11    13        INIT_FCALL                                               'var_dump'
         14        ROPE_INIT                                     3  ~11     'product%3A+'
         15        ROPE_ADD                                      1  ~11     ~11, !2
         16        ROPE_END                                      2  ~10     ~11, '%0A'
         17        SEND_VAL                                                 ~10
         18        DO_ICALL                                                 
   14    19        INIT_FCALL                                               'number_format'
         20        SEND_VAR                                                 !2
         21        SEND_VAL                                                 2
         22        DO_ICALL                                         $14     
         23        ECHO                                                     $14
         24        ECHO                                                     '%0A'
   16    25        INIT_FCALL                                               'printf'
         26        SEND_VAL                                                 '%25.2f'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                         $15     
         29        ECHO                                                     $15
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.51 ms | 1395 KiB | 21 Q