3v4l.org

run code in 300+ PHP versions simultaneously
<?php $amt = '$1.5'; $amt = $amount * (substr(amt, 0, (strlen($amt)-1) ) / 100); $amt = round($amt, 2, PHP_ROUND_HALF_UP); echo (float)$amt;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7bTAq
function name:  (null)
number of ops:  21
compiled vars:  !0 = $amt, !1 = $amount
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%241.5'
    5     1        INIT_FCALL                                               'substr'
          2        FETCH_CONSTANT                                   ~3      'amt'
          3        SEND_VAL                                                 ~3
          4        SEND_VAL                                                 0
          5        STRLEN                                           ~4      !0
          6        SUB                                              ~5      ~4, 1
          7        SEND_VAL                                                 ~5
          8        DO_ICALL                                         $6      
          9        DIV                                              ~7      $6, 100
         10        MUL                                              ~8      !1, ~7
         11        ASSIGN                                                   !0, ~8
    6    12        INIT_FCALL                                               'round'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 2
         15        SEND_VAL                                                 1
         16        DO_ICALL                                         $10     
         17        ASSIGN                                                   !0, $10
    8    18        CAST                                          5  ~12     !0
         19        ECHO                                                     ~12
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
196.36 ms | 1395 KiB | 17 Q