3v4l.org

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

Class customException:
Function errormessage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0Zmfd
function name:  errorMessage
number of ops:  6
compiled vars:  !0 = $errorMsg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_METHOD_CALL                                         'getMessage'
          1        DO_FCALL                                      0  $1      
          2        CONCAT                                           ~2      $1, '+is+not+a+valid+E-Mail+address.'
          3        ASSIGN                                                   !0, ~2
    6     4      > RETURN                                                   !0
    7     5*     > RETURN                                                   null

End of function errormessage

End of class customException.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.8 ms | 1388 KiB | 15 Q