3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = 'Call 123-456-7800 between 16:00 and 4:00 for confidential support'; $f = new NumberFormatter('en', NumberFormatter::SPELLOUT); echo preg_replace_callback( '/\b(\d)(\d)(\d)-(\d)(\d)(\d)-(\d)(\d)(\d)(\d)\b/', fn($m) => implode(' ', array_map([$f, 'format'], array_slice($m, 1))), $text );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Etnp
function name:  (null)
number of ops:  16
compiled vars:  !0 = $text, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Call+123-456-7800+between+16%3A00+and+4%3A00+for+confidential+support'
    5     1        NEW                                              $3      'NumberFormatter'
          2        SEND_VAL_EX                                              'en'
          3        FETCH_CLASS_CONSTANT                             ~4      'NumberFormatter', 'SPELLOUT'
          4        SEND_VAL_EX                                              ~4
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $3
    6     7        INIT_FCALL                                               'preg_replace_callback'
    7     8        SEND_VAL                                                 '%2F%5Cb%28%5Cd%29%28%5Cd%29%28%5Cd%29-%28%5Cd%29%28%5Cd%29%28%5Cd%29-%28%5Cd%29%28%5Cd%29%28%5Cd%29%28%5Cd%29%5Cb%2F'
    8     9        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
         10        BIND_LEXICAL                                             ~7, !1
         11        SEND_VAL                                                 ~7
    9    12        SEND_VAR                                                 !0
    6    13        DO_ICALL                                         $8      
    9    14        ECHO                                                     $8
   10    15      > 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/9Etnp
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $m, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        INIT_FCALL                                               'implode'
          3        SEND_VAL                                                 '+'
          4        INIT_FCALL                                               'array_map'
          5        INIT_ARRAY                                       ~2      !1
          6        ADD_ARRAY_ELEMENT                                ~2      'format'
          7        SEND_VAL                                                 ~2
          8        INIT_FCALL                                               'array_slice'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 1
         11        DO_ICALL                                         $3      
         12        SEND_VAR                                                 $3
         13        DO_ICALL                                         $4      
         14        SEND_VAR                                                 $4
         15        DO_ICALL                                         $5      
         16      > RETURN                                                   $5
         17*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.9 ms | 1006 KiB | 17 Q