3v4l.org

run code in 300+ PHP versions simultaneously
<?php $locales = [ 'en_US', 'es_ES', ]; $data = [ '1.234.567,891', '1,234,567.891', '1.23E987', 'Five', ]; foreach ($locales as $locale) { $fmt = new NumberFormatter($locale, NumberFormatter::DECIMAL); foreach ($data as $input) { $parsed = $fmt->parse($input); printf("In %s '%s' is %s (%s)\n", $locale, $input, $parsed ?: 'not a number', $fmt->getErrorMessage()); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 30
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 30
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 28
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 28
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 28
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/IqgOB
function name:  (null)
number of ops:  32
compiled vars:  !0 = $locales, !1 = $data, !2 = $locale, !3 = $fmt, !4 = $input, !5 = $parsed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    7     1        ASSIGN                                                   !1, <array>
   14     2      > FE_RESET_R                                       $8      !0, ->30
          3    > > FE_FETCH_R                                               $8, !2, ->30
   15     4    >   NEW                                              $9      'NumberFormatter'
          5        SEND_VAR_EX                                              !2
          6        FETCH_CLASS_CONSTANT                             ~10     'NumberFormatter', 'DECIMAL'
          7        SEND_VAL_EX                                              ~10
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !3, $9
   16    10      > FE_RESET_R                                       $13     !1, ->28
         11    > > FE_FETCH_R                                               $13, !4, ->28
   17    12    >   INIT_METHOD_CALL                                         !3, 'parse'
         13        SEND_VAR_EX                                              !4
         14        DO_FCALL                                      0  $14     
         15        ASSIGN                                                   !5, $14
   18    16        INIT_FCALL                                               'printf'
         17        SEND_VAL                                                 'In+%25s+%27%25s%27+is+%25s+%28%25s%29%0A'
         18        SEND_VAR                                                 !2
         19        SEND_VAR                                                 !4
         20        JMP_SET                                          ~16     !5, ->22
         21        QM_ASSIGN                                        ~16     'not+a+number'
         22        SEND_VAL                                                 ~16
         23        INIT_METHOD_CALL                                         !3, 'getErrorMessage'
         24        DO_FCALL                                      0  $17     
         25        SEND_VAR                                                 $17
         26        DO_ICALL                                                 
   16    27      > JMP                                                      ->11
         28    >   FE_FREE                                                  $13
   14    29      > JMP                                                      ->3
         30    >   FE_FREE                                                  $8
   20    31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.67 ms | 1401 KiB | 15 Q