3v4l.org

run code in 300+ PHP versions simultaneously
<?php $usPhone = '123-456-7800'; $digits = sscanf($usPhone, '%1s%1s%1s-%1s%1s%1s-%2s%2s'); $f = new NumberFormatter('en', NumberFormatter::SPELLOUT); echo implode( ' ', array_map( fn($d) => ($d !== (string)(int)$d ? 'oh ' : '') . (!(int)$d ? 'oh' : $f->format((int)$d)), $digits ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZrRKX
function name:  (null)
number of ops:  24
compiled vars:  !0 = $usPhone, !1 = $digits, !2 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '123-456-7800'
    5     1        INIT_FCALL                                               'sscanf'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%251s%251s%251s-%251s%251s%251s-%252s%252s'
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    7     6        NEW                                              $6      'NumberFormatter'
          7        SEND_VAL_EX                                              'en'
          8        FETCH_CLASS_CONSTANT                             ~7      'NumberFormatter', 'SPELLOUT'
          9        SEND_VAL_EX                                              ~7
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $6
    8    12        INIT_FCALL                                               'implode'
    9    13        SEND_VAL                                                 '+'
   10    14        INIT_FCALL                                               'array_map'
   11    15        DECLARE_LAMBDA_FUNCTION                          ~10     [0]
         16        BIND_LEXICAL                                             ~10, !2
   12    17        SEND_VAL                                                 ~10
   13    18        SEND_VAR                                                 !1
   10    19        DO_ICALL                                         $11     
   13    20        SEND_VAR                                                 $11
    8    21        DO_ICALL                                         $12     
   13    22        ECHO                                                     $12
   15    23      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
Branch analysis from position: 14
filename:       /in/ZrRKX
function name:  {closure}
number of ops:  22
compiled vars:  !0 = $d, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        CAST                                          4  ~2      !0
          3        CAST                                          6  ~3      ~2
          4        IS_NOT_IDENTICAL                                         !0, ~3
          5      > JMPZ                                                     ~4, ->8
          6    >   QM_ASSIGN                                        ~5      'oh+'
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~5      ''
   12     9    >   CAST                                          4  ~6      !0
         10        BOOL_NOT                                         ~7      ~6
         11      > JMPZ                                                     ~7, ->14
         12    >   QM_ASSIGN                                        ~8      'oh'
         13      > JMP                                                      ->19
         14    >   INIT_METHOD_CALL                                         !1, 'format'
         15        CAST                                          4  ~9      !0
         16        SEND_VAL_EX                                              ~9
         17        DO_FCALL                                      0  $10     
         18        QM_ASSIGN                                        ~8      $10
         19    >   CONCAT                                           ~11     ~5, ~8
         20      > RETURN                                                   ~11
         21*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.77 ms | 1009 KiB | 16 Q