3v4l.org

run code in 300+ PHP versions simultaneously
<?php function tryGetPhoneNumber($input, &$phoneNumber) { if (preg_match('/(?<phoneNumber>\d{3}-\d{3}-\d{4}/)', $input, $match)) { $phoneNumber = $match['phoneNumber']; return true; } $phoneNumber = null; return false; } $phoneNumber = null; if (tryGetPhoneNumber("I'm going to call 555-123-4567 tomorrow.", $phoneNumber)) { var_dump($phoneNumber); exit; } echo 'No phone number.';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qssha
function name:  (null)
number of ops:  12
compiled vars:  !0 = $phoneNumber
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, null
   13     1        INIT_FCALL                                               'trygetphonenumber'
          2        SEND_VAL                                                 'I%27m+going+to+call+555-123-4567+tomorrow.'
          3        SEND_REF                                                 !0
          4        DO_FCALL                                      0  $2      
          5      > JMPZ                                                     $2, ->10
   14     6    >   INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   15     9      > EXIT                                                     
   17    10    >   ECHO                                                     'No+phone+number.'
         11      > RETURN                                                   1

Function trygetphonenumber:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qssha
function name:  tryGetPhoneNumber
number of ops:  14
compiled vars:  !0 = $input, !1 = $phoneNumber, !2 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%2F%28%3F%3CphoneNumber%3E%5Cd%7B3%7D-%5Cd%7B3%7D-%5Cd%7B4%7D%2F%29'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $3      
          7      > JMPZ                                                     $3, ->11
    5     8    >   FETCH_DIM_R                                      ~4      !2, 'phoneNumber'
          9        ASSIGN                                                   !1, ~4
    6    10      > RETURN                                                   <true>
    8    11    >   ASSIGN                                                   !1, null
    9    12      > RETURN                                                   <false>
   10    13*     > RETURN                                                   null

End of function trygetphonenumber

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.19 ms | 1399 KiB | 18 Q