3v4l.org

run code in 300+ PHP versions simultaneously
<?php $inp= "12.345kk"; $number = 0; if (preg_match('/^([\d.]+)([kt]+)/', $inp, $matches)) { $number = $matches[1]; $multipliers = $matches[2]; $number *= 1000 ** strlen($multipliers); } echo $number;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/4L8Ml
function name:  (null)
number of ops:  17
compiled vars:  !0 = $inp, !1 = $number, !2 = $matches, !3 = $multipliers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '12.345kk'
    4     1        ASSIGN                                                   !1, 0
    5     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%2F%5E%28%5B%5Cd.%5D%2B%29%28%5Bkt%5D%2B%29%2F'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $6      
          7      > JMPZ                                                     $6, ->15
    6     8    >   FETCH_DIM_R                                      ~7      !2, 1
          9        ASSIGN                                                   !1, ~7
    7    10        FETCH_DIM_R                                      ~9      !2, 2
         11        ASSIGN                                                   !3, ~9
    8    12        STRLEN                                           ~11     !3
         13        POW                                              ~12     1000, ~11
         14        ASSIGN_OP                                     3          !1, ~12
   10    15    >   ECHO                                                     !1
   11    16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.5 ms | 1399 KiB | 15 Q