3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $_email_pattern = '#[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}#i'; $author = ''; $author_email = 'jackjohnson@gmail.com'; if ((empty($author)) && (!empty($author_email))) { $_try_author = $author_email; if (strpos($_try_author, '@') !== false) { echo "valid email detected\n"; $_try_author = trim(preg_replace($_email_pattern, '', $_try_author)); var_dump($_try_author); $_try_author = trim(preg_replace('#[<()>\[\]._%+-]#',' ',$_try_author)); var_dump($_try_author); } else { echo "invalid email detected\n"; $author_email = ''; // not a valid email } $author = $_try_author; } echo 'AUTHOR: '.$author."\n"; echo 'AUTHOR EMAIL: '.$author_email."\n";
based on VGiPP
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
Jump found. Position 1 = 9, Position 2 = 45
Branch analysis from position: 9
Jump found. Position 1 = 16, Position 2 = 42
Branch analysis from position: 16
Jump found. Position 1 = 44
Branch analysis from position: 44
Jump found. Position 1 = -2
Branch analysis from position: 42
Jump found. Position 1 = -2
Branch analysis from position: 45
Branch analysis from position: 8
filename:       /in/aOIUj
function name:  (null)
number of ops:  52
compiled vars:  !0 = $_email_pattern, !1 = $author, !2 = $author_email, !3 = $_try_author
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   ASSIGN                                                   !0, '%23%5BA-Z0-9._%25%2B-%5D%2B%40%5BA-Z0-9.-%5D%2B%5C.%5BA-Z%5D%7B2%2C6%7D%23i'
   4     1        ASSIGN                                                   !1, ''
   5     2        ASSIGN                                                   !2, 'jackjohnson%40gmail.com'
   6     3        ISSET_ISEMPTY_VAR                           293601280  ~7      !1
         4      > JMPZ_EX                                          ~7      ~7, ->8
         5    >   ISSET_ISEMPTY_VAR                           293601280  ~8      !2
         6        BOOL_NOT                                         ~9      ~8
         7        BOOL                                             ~7      ~9
         8    > > JMPZ                                                     ~7, ->45
   7     9    >   ASSIGN                                                   !3, !2
   8    10        INIT_FCALL                                               'strpos'
        11        SEND_VAR                                                 !3
        12        SEND_VAL                                                 '%40'
        13        DO_ICALL                                         $11     
        14        IS_NOT_IDENTICAL                                 ~12     $11, <false>
        15      > JMPZ                                                     ~12, ->42
   9    16    >   ECHO                                                     'valid+email+detected%0A'
  10    17        INIT_FCALL                                               'trim'
        18        INIT_FCALL                                               'preg_replace'
        19        SEND_VAR                                                 !0
        20        SEND_VAL                                                 ''
        21        SEND_VAR                                                 !3
        22        DO_ICALL                                         $13     
        23        SEND_VAR                                                 $13
        24        DO_ICALL                                         $14     
        25        ASSIGN                                                   !3, $14
  11    26        INIT_FCALL                                               'var_dump'
        27        SEND_VAR                                                 !3
        28        DO_ICALL                                                 
  12    29        INIT_FCALL                                               'trim'
        30        INIT_FCALL                                               'preg_replace'
        31        SEND_VAL                                                 '%23%5B%3C%28%29%3E%5C%5B%5C%5D._%25%2B-%5D%23'
        32        SEND_VAL                                                 '+'
        33        SEND_VAR                                                 !3
        34        DO_ICALL                                         $17     
        35        SEND_VAR                                                 $17
        36        DO_ICALL                                         $18     
        37        ASSIGN                                                   !3, $18
  13    38        INIT_FCALL                                               'var_dump'
        39        SEND_VAR                                                 !3
        40        DO_ICALL                                                 
        41      > JMP                                                      ->44
  15    42    >   ECHO                                                     'invalid+email+detected%0A'
  16    43        ASSIGN                                                   !2, ''
  18    44    >   ASSIGN                                                   !1, !3
  20    45    >   CONCAT                                           ~23     'AUTHOR%3A+', !1
        46        CONCAT                                           ~24     ~23, '%0A'
        47        ECHO                                                     ~24
  21    48        CONCAT                                           ~25     'AUTHOR+EMAIL%3A+', !2
        49        CONCAT                                           ~26     ~25, '%0A'
        50        ECHO                                                     ~26
        51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.2.0