3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = '1.000.000,12'; $old = str_replace('.', '', $test); $old = (float) str_replace(',', '.', $old); $new = str_replace(array('.', ','), array('', '.'), $test); echo 'old: ' . $amount; echo 'new: ' . $new;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bB2ue
function name:  (null)
number of ops:  25
compiled vars:  !0 = $test, !1 = $old, !2 = $new, !3 = $amount
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '1.000.000%2C12'
    5     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 '.'
          3        SEND_VAL                                                 ''
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !1, $5
    6     7        INIT_FCALL                                               'str_replace'
          8        SEND_VAL                                                 '%2C'
          9        SEND_VAL                                                 '.'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $7      
         12        CAST                                          5  ~8      $7
         13        ASSIGN                                                   !1, ~8
    8    14        INIT_FCALL                                               'str_replace'
         15        SEND_VAL                                                 <array>
         16        SEND_VAL                                                 <array>
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $10     
         19        ASSIGN                                                   !2, $10
   10    20        CONCAT                                           ~12     'old%3A+', !3
         21        ECHO                                                     ~12
   11    22        CONCAT                                           ~13     'new%3A+', !2
         23        ECHO                                                     ~13
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.25 ms | 1395 KiB | 15 Q