Handling Multiple Exceptions with PHP 7.1

I'm Pierre-Henry Soria. A passionate full stack engineer, building things that matter, making a real impact on the world.
Really like to take care of others and manage my workflow based on productivity methodologies.
Open to fast-paced changes with rapidly evolving business and technologies. I'm always thirsty to learn and undertake new exciting things and thrilling challenges.
Here is how you can handle easily multiple error exceptions thanks to PHP 7.1!
๐ Source code of the example project https://gist.github.com/pH-7/5ba7f83a9e1befc46a68379301eec41e
Example ๐
try {
$person = new Person('Pierre');
echo $person->greeting('morning'); // can be 'morning', 'afternoon', or 'evening'
} catch(InvalidNameException | InvalidDayMomentException $err) { // Catch multiple exceptions at once
echo $err->getMessage();
}
๐ My Udemy course on how to build a real-world PHP 8 application from scratch is now available: https://www.udemy.com/course/create-real-world-php-webapp-from-scratch/
๐ My GitHub https://github.com/pH-7 where I regularly publish packages, libraries, and proof of concepts.




