3v4l.org

run code in 500+ 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:  23
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        FRAMELESS_ICALL_3                str_replace         ~3      <array>, <array>
    9     3        OP_DATA                                                      !0
          4        SEND_VAL                                                     ~3
    5     5        DO_ICALL                                             $4      
    9     6        ECHO                                                         $4
   13     7        ECHO                                                         '%0A---%0A'
   15     8        NEW                                                  $5      'NumberFormatter'
   16     9        SEND_VAL_EX                                                  'de_DE'
   17    10        FETCH_CLASS_CONSTANT                                 ~6      'NumberFormatter', 'DECIMAL'
         11        SEND_VAL_EX                                                  ~6
   15    12        DO_FCALL                                          0          
         13        ASSIGN                                                       !1, $5
   19    14        INIT_FCALL                                                   'array_reduce'
   20    15        SEND_VAR                                                     !0
   21    16        DECLARE_LAMBDA_FUNCTION                              ~9      [0]
         17        BIND_LEXICAL                                                 ~9, !1
         18        SEND_VAL                                                     ~9
   22    19        SEND_VAL                                                     0
   19    20        DO_ICALL                                             $10     
   22    21        ECHO                                                         $10
   23    22      > 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:/in/61H8l:21}
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.5.0


preferences:
159.28 ms | 1461 KiB | 15 Q