3v4l.org

run code in 300+ PHP versions simultaneously
<?php function formatPhone($numOld) { return preg_replace('/^(?:\+?27|0)?/','+27', $numOld); } echo formatPhone("797734809") . "\n"; echo formatPhone("0797734809") . "\n"; echo formatPhone("27797734809") . "\n"; echo formatPhone("+27797734809");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LOF1A
function name:  (null)
number of ops:  20
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'formatphone'
          1        SEND_VAL                                                 '797734809'
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      $0, '%0A'
          4        ECHO                                                     ~1
    8     5        INIT_FCALL                                               'formatphone'
          6        SEND_VAL                                                 '0797734809'
          7        DO_FCALL                                      0  $2      
          8        CONCAT                                           ~3      $2, '%0A'
          9        ECHO                                                     ~3
    9    10        INIT_FCALL                                               'formatphone'
         11        SEND_VAL                                                 '27797734809'
         12        DO_FCALL                                      0  $4      
         13        CONCAT                                           ~5      $4, '%0A'
         14        ECHO                                                     ~5
   10    15        INIT_FCALL                                               'formatphone'
         16        SEND_VAL                                                 '%2B27797734809'
         17        DO_FCALL                                      0  $6      
         18        ECHO                                                     $6
         19      > RETURN                                                   1

Function formatphone:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LOF1A
function name:  formatPhone
number of ops:  8
compiled vars:  !0 = $numOld
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%5E%28%3F%3A%5C%2B%3F27%7C0%29%3F%2F'
          3        SEND_VAL                                                 '%2B27'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
    5     7*     > RETURN                                                   null

End of function formatphone

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.21 ms | 1008 KiB | 18 Q