New features and changes
<?php
function giveMeYourString(int $ohYeah): string {
return (string) $ohYeah;
}
// This will throw a TypeError exception (yeah, exception, we will see it later)
giveMeYourString("I'm already a string I understood nothing");
// This will work without problems
giveMeYourString(13700);<?php
try {
$this->hardcoreRiskyCode();
} catch (\Exception $exception) {
echo $exception->getMessage();
} catch (\Error $error) {
echo $error->getMessage();
} catch (\Throwable $throwable) {
echo "Something terrible happened. Exception or Error, I just don't know";
}