3v4l.org

run code in 500+ PHP versions simultaneously
<?php $extractor = function ($str) { $str = preg_replace('/\s*(?:\[at]|@)\s*/', '@', $str); $str = preg_replace('/\s*\(dot\)\s*/', '.', $str); $regexp = '/\b[a-z0-9_.-]+@(?:[a-z0-9-]+\.)+[a-z0-9]{2,4}\b/i'; preg_match_all($regexp, $str, $m); return isset($m[0]) ? $m[0] : []; }; $test_string = 'This is a test string... test1@example.org Test different formats: test2@example.org; <a href="test3@example.org">foobar</a> <test4@example.org> strange formats: test5@example.org test6[at]example.org test7@example.net.org.com test8@ example.org test9@!foo!.org test10.abc [at] hello (dot) com foobar '; print_r( $extractor($test_string) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KZgKY
function name:  (null)
number of ops:  10
compiled vars:  !0 = $extractor, !1 = $test_string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                              ~2      [0]
          1        ASSIGN                                                       !0, ~2
   11     2        ASSIGN                                                       !1, 'This+is+a+test+string...%0A++++test1%40example.org%0A++++Test+different+formats%3A%0A++++test2%40example.org%3B%0A++++%3Ca+href%3D%22test3%40example.org%22%3Efoobar%3C%2Fa%3E%0A++++%3Ctest4%40example.org%3E%0A++++++++strange+formats%3A%0A++++test5%40example.org%0A++++test6%5Bat%5Dexample.org%0A++++test7%40example.net.org.com%0A++++test8%40+example.org%0A++++test9%40%21foo%21.org%0A++++test10.abc+%5Bat%5D+hello+%28dot%29+com%0A++++++++foobar%0A'
   27     3        INIT_FCALL                                                   'print_r'
          4        INIT_DYNAMIC_CALL                                            !0
          5        SEND_VAR_EX                                                  !1
          6        DO_FCALL                                          0  $5      
          7        SEND_VAR                                                     $5
          8        DO_ICALL                                                     
          9      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
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: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KZgKY
function name:  {closure:/in/KZgKY:3}
number of ops:  21
compiled vars:  !0 = $str, !1 = $regexp, !2 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        FRAMELESS_ICALL_3                preg_replace        ~3      '%2F%5Cs%2A%28%3F%3A%5C%5Bat%5D%7C%40%29%5Cs%2A%2F', '%40'
          2        OP_DATA                                                      !0
          3        ASSIGN                                                       !0, ~3
    5     4        FRAMELESS_ICALL_3                preg_replace        ~5      '%2F%5Cs%2A%5C%28dot%5C%29%5Cs%2A%2F', '.'
          5        OP_DATA                                                      !0
          6        ASSIGN                                                       !0, ~5
    6     7        ASSIGN                                                       !1, '%2F%5Cb%5Ba-z0-9_.-%5D%2B%40%28%3F%3A%5Ba-z0-9-%5D%2B%5C.%29%2B%5Ba-z0-9%5D%7B2%2C4%7D%5Cb%2Fi'
    7     8        INIT_FCALL                                                   'preg_match_all'
          9        SEND_VAR                                                     !1
         10        SEND_VAR                                                     !0
         11        SEND_REF                                                     !2
         12        DO_ICALL                                                     
    8    13        ISSET_ISEMPTY_DIM_OBJ                             0          !2, 0
         14      > JMPZ                                                         ~9, ->18
         15    >   FETCH_DIM_R                                          ~10     !2, 0
         16        QM_ASSIGN                                            ~11     ~10
         17      > JMP                                                          ->19
         18    >   QM_ASSIGN                                            ~11     <array>
         19    > > RETURN                                                       ~11
    9    20*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
127.67 ms | 483 KiB | 9 Q