3v4l.org

run code in 300+ PHP versions simultaneously
<?php $formattedMoney = '-$1000'; $currency = 'USD'; $parser = new \NumberFormatter('en_US', \NumberFormatter::CURRENCY); $parser->setAttribute(\NumberFormatter::FRACTION_DIGITS, 2); $parser->setAttribute(\NumberFormatter::NEGATIVE_PREFIX, '-'); $decimal = $parser->parseCurrency($formattedMoney, $currency); var_dump($decimal);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TOKho
function name:  (null)
number of ops:  27
compiled vars:  !0 = $formattedMoney, !1 = $currency, !2 = $parser, !3 = $decimal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '-%241000'
    4     1        ASSIGN                                                   !1, 'USD'
    6     2        NEW                                              $6      'NumberFormatter'
          3        SEND_VAL_EX                                              'en_US'
          4        FETCH_CLASS_CONSTANT                             ~7      'NumberFormatter', 'CURRENCY'
          5        SEND_VAL_EX                                              ~7
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $6
    7     8        INIT_METHOD_CALL                                         !2, 'setAttribute'
          9        FETCH_CLASS_CONSTANT                             ~10     'NumberFormatter', 'FRACTION_DIGITS'
         10        SEND_VAL_EX                                              ~10
         11        SEND_VAL_EX                                              2
         12        DO_FCALL                                      0          
    8    13        INIT_METHOD_CALL                                         !2, 'setAttribute'
         14        FETCH_CLASS_CONSTANT                             ~12     'NumberFormatter', 'NEGATIVE_PREFIX'
         15        SEND_VAL_EX                                              ~12
         16        SEND_VAL_EX                                              '-'
         17        DO_FCALL                                      0          
    9    18        INIT_METHOD_CALL                                         !2, 'parseCurrency'
         19        SEND_VAR_EX                                              !0
         20        SEND_VAR_EX                                              !1
         21        DO_FCALL                                      0  $14     
         22        ASSIGN                                                   !3, $14
   10    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !3
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.79 ms | 1395 KiB | 15 Q