Hallo allen,

Ik ben aan het leren om de Exception error afhandeling te leren in PHP, nu kan ik niet echt precies een goede tutorial vinden om je eigen custom exceptions te maken. Ben ik op deze manier goed bezig, of zitten hier fouten in?

PHP Code:
<?php

    
function performAction($action){
            
$allowed    0;
        if(
$action != $allowed){
            throw new 
Exception(array('errorNumber' => '1','errorMessage' => 'You are not allowed to perform this action.');
        } 
            return 
true;
    }

?>
PHP Code:
<?php    
    
try { 
    
    
performAction(1); 
    
    } catch(
Exception $e) { 
    
    echo 
$e->errorNumber(); 
    
$e->errorMessage(); 
    
    }
    
?>
Alvast bedankt!