3v4l.org

run code in 500+ PHP versions simultaneously
<?php class BelgianUSDollarSignFormatter extends NumberFormatter { public function formatCurrency(float $amount, string $currency): string|false { return str_replace('щ.д.', '$', parent::formatCurrency($amount, $currency)); } } $curr = new BelgianUSDollarSignFormatter('bg_BG', NumberFormatter::CURRENCY); $amount = '5665.25'; $currency = 'USD'; echo $curr->formatCurrency($amount, $currency).PHP_EOL; $currency = 'EUR'; echo $curr->formatCurrency($amount, $currency).PHP_EOL; $currency = 'BGN'; echo $curr->formatCurrency($amount, $currency).PHP_EOL; $currency = 'AUD'; echo $curr->formatCurrency($amount, $currency).PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EUMJg
function name:  (null)
number of ops:  37
compiled vars:  !0 = $curr, !1 = $amount, !2 = $currency
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'belgianusdollarsignformatter', 'numberformatter'
   11     1        NEW                                                  $3      'BelgianUSDollarSignFormatter'
          2        SEND_VAL_EX                                                  'bg_BG'
          3        FETCH_CLASS_CONSTANT                                 ~4      'NumberFormatter', 'CURRENCY'
          4        SEND_VAL_EX                                                  ~4
          5        DO_FCALL                                          0          
          6        ASSIGN                                                       !0, $3
   12     7        ASSIGN                                                       !1, '5665.25'
   14     8        ASSIGN                                                       !2, 'USD'
   15     9        INIT_METHOD_CALL                                             !0, 'formatCurrency'
         10        SEND_VAR_EX                                                  !1
         11        SEND_VAR_EX                                                  !2
         12        DO_FCALL                                          0  $9      
         13        CONCAT                                               ~10     $9, '%0A'
         14        ECHO                                                         ~10
   16    15        ASSIGN                                                       !2, 'EUR'
   17    16        INIT_METHOD_CALL                                             !0, 'formatCurrency'
         17        SEND_VAR_EX                                                  !1
         18        SEND_VAR_EX                                                  !2
         19        DO_FCALL                                          0  $12     
         20        CONCAT                                               ~13     $12, '%0A'
         21        ECHO                                                         ~13
   18    22        ASSIGN                                                       !2, 'BGN'
   19    23        INIT_METHOD_CALL                                             !0, 'formatCurrency'
         24        SEND_VAR_EX                                                  !1
         25        SEND_VAR_EX                                                  !2
         26        DO_FCALL                                          0  $15     
         27        CONCAT                                               ~16     $15, '%0A'
         28        ECHO                                                         ~16
   20    29        ASSIGN                                                       !2, 'AUD'
   21    30        INIT_METHOD_CALL                                             !0, 'formatCurrency'
         31        SEND_VAR_EX                                                  !1
         32        SEND_VAR_EX                                                  !2
         33        DO_FCALL                                          0  $18     
         34        CONCAT                                               ~19     $18, '%0A'
         35        ECHO                                                         ~19
   22    36      > RETURN                                                       1

Class BelgianUSDollarSignFormatter:
Function formatcurrency:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EUMJg
function name:  formatCurrency
number of ops:  12
compiled vars:  !0 = $amount, !1 = $currency
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    7     2        INIT_STATIC_METHOD_CALL                                      'formatCurrency'
          3        SEND_VAR_EX                                                  !0
          4        SEND_VAR_EX                                                  !1
          5        DO_FCALL                                          0  $2      
          6        FRAMELESS_ICALL_3                str_replace         ~3      '%D1%89.%D0%B4.', '%24'
          7        OP_DATA                                                      $2
          8        VERIFY_RETURN_TYPE                                           ~3
          9      > RETURN                                                       ~3
    8    10*       VERIFY_RETURN_TYPE                                           
         11*     > RETURN                                                       null

End of function formatcurrency

End of class BelgianUSDollarSignFormatter.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.19 ms | 1594 KiB | 15 Q