3v4l.org

run code in 300+ PHP versions simultaneously
<?php $values = ['12,30', '116,10', '1.563,14']; echo array_sum( str_replace( ['.', ','], ['', '.'], $values ) ); echo "\n---\n"; $f = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL ); echo array_reduce( $values, fn($result, $v) => $result + $f->parse($v), 0 );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/61H8l
function name:  (null)
number of ops:  26
compiled vars:  !0 = $values, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'array_sum'
    6     2        INIT_FCALL                                               'str_replace'
    7     3        SEND_VAL                                                 <array>
    8     4        SEND_VAL                                                 <array>
    9     5        SEND_VAR                                                 !0
    6     6        DO_ICALL                                         $3      
    9     7        SEND_VAR                                                 $3
    5     8        DO_ICALL                                         $4      
    9     9        ECHO                                                     $4
   13    10        ECHO                                                     '%0A---%0A'
   15    11        NEW                                              $5      'NumberFormatter'
   16    12        SEND_VAL_EX                                              'de_DE'
   17    13        FETCH_CLASS_CONSTANT                             ~6      'NumberFormatter', 'DECIMAL'
         14        SEND_VAL_EX                                              ~6
   15    15        DO_FCALL                                      0          
         16        ASSIGN                                                   !1, $5
   19    17        INIT_FCALL                                               'array_reduce'
   20    18        SEND_VAR                                                 !0
   21    19        DECLARE_LAMBDA_FUNCTION                          ~9      [0]
         20        BIND_LEXICAL                                             ~9, !1
         21        SEND_VAL                                                 ~9
   22    22        SEND_VAL                                                 0
   19    23        DO_ICALL                                         $10     
   22    24        ECHO                                                     $10
   23    25      > 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/61H8l
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $result, !1 = $v, !2 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        INIT_METHOD_CALL                                         !2, 'parse'
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0  $3      
          6        ADD                                              ~4      !0, $3
          7      > RETURN                                                   ~4
          8*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
125.66 ms | 1003 KiB | 16 Q