3v4l.org

run code in 300+ PHP versions simultaneously
<?php class customException extends Exception { public function errorMessage() { //error message $errorMsg = 'Error on line '.$this->getLine().' in '.$this->getFile() .': <b>'.$this->getMessage().'</b> is not a valid E-Mail address'; return $errorMsg; } } $email = "someone@example.com"; try { //check if if(filter_var($email, FILTER_VALIDATE_EMAIL) === FALSE) { //throw exception if email is not valid throw new customException($email); } //check for "example" in mail address if(strpos($email, "example") !== FALSE) { throw new Exception("$email is an example e-mail"); } } catch (customException $e) { echo $e->errorMessage(); } catch(Exception $e) { echo $e->getMessage(); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 24
Branch analysis from position: 24
2 jumps found. (Code = 107) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Branch analysis from position: 29
2 jumps found. (Code = 107) Position 1 = 30, Position 2 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 29
Branch analysis from position: 29
filename:       /in/D4C0g
function name:  (null)
number of ops:  34
compiled vars:  !0 = $email, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, 'someone%40example.com'
   15     1        INIT_FCALL                                               'filter_var'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 274
          4        DO_ICALL                                         $3      
          5        TYPE_CHECK                                    4          $3
          6      > JMPZ                                                     ~4, ->11
   17     7    >   NEW                                              $5      'customException'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
         10      > THROW                                         0          $5
   20    11    >   INIT_FCALL                                               'strpos'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 'example'
         14        DO_ICALL                                         $7      
         15        TYPE_CHECK                                  1018          $7
         16      > JMPZ                                                     ~8, ->23
   21    17    >   NEW                                              $9      'Exception'
         18        NOP                                                      
         19        FAST_CONCAT                                      ~10     !0, '+is+an+example+e-mail'
         20        SEND_VAL_EX                                              ~10
         21        DO_FCALL                                      0          
         22      > THROW                                         0          $9
         23    > > JMP                                                      ->33
   25    24  E > > CATCH                                                    'customException', ->29
   26    25    >   INIT_METHOD_CALL                                         !1, 'errorMessage'
         26        DO_FCALL                                      0  $12     
         27        ECHO                                                     $12
         28      > JMP                                                      ->33
   29    29  E > > CATCH                                       last         'Exception'
   30    30    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         31        DO_FCALL                                      0  $13     
         32        ECHO                                                     $13
   31    33    > > RETURN                                                   1

Class customException:
Function errormessage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D4C0g
function name:  errorMessage
number of ops:  15
compiled vars:  !0 = $errorMsg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_METHOD_CALL                                         'getLine'
          1        DO_FCALL                                      0  $1      
          2        CONCAT                                           ~2      'Error+on+line+', $1
          3        CONCAT                                           ~3      ~2, '+in+'
          4        INIT_METHOD_CALL                                         'getFile'
          5        DO_FCALL                                      0  $4      
          6        CONCAT                                           ~5      ~3, $4
    6     7        CONCAT                                           ~6      ~5, '%3A+%3Cb%3E'
          8        INIT_METHOD_CALL                                         'getMessage'
          9        DO_FCALL                                      0  $7      
         10        CONCAT                                           ~8      ~6, $7
         11        CONCAT                                           ~9      ~8, '%3C%2Fb%3E+is+not+a+valid+E-Mail+address'
    5    12        ASSIGN                                                   !0, ~9
    7    13      > RETURN                                                   !0
    8    14*     > RETURN                                                   null

End of function errormessage

End of class customException.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.59 ms | 1400 KiB | 17 Q