3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ '1,000.00', '1,000.000', '1.000,00', '1.000,000', '1.00', '1.000', '1,00', '1,000', ]; var_export( preg_replace_callback( '/\.(?=.*,)|,(?=\d*$)/', fn($m) => ['.' => ',', ',' => '.'][$m[0]], $tests ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JbP1r
function name:  (null)
number of ops:  11
compiled vars:  !0 = $tests
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'var_export'
   14     2        INIT_FCALL                                               'preg_replace_callback'
   15     3        SEND_VAL                                                 '%2F%5C.%28%3F%3D.%2A%2C%29%7C%2C%28%3F%3D%5Cd%2A%24%29%2F'
   16     4        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
          5        SEND_VAL                                                 ~2
   17     6        SEND_VAR                                                 !0
   14     7        DO_ICALL                                         $3      
   17     8        SEND_VAR                                                 $3
   13     9        DO_ICALL                                                 
   19    10      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JbP1r
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        FETCH_DIM_R                                      ~1      !0, 0
          2        FETCH_DIM_R                                      ~2      <array>, ~1
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.51 ms | 998 KiB | 15 Q