exception handling class php
Try catch comes under exception handeling concept where using this we control the runtime error and modify the message as we want.
// function created with exception throw
function checkdata($number){
if($number > 10){
throw new Exception("Number is greater than 10");
}
return true;
}
// try block starts
try{
checkdata(15);
echo "The number is below 10";
}
// catch block
catch(Exception $e){
echo "Message :".$e->getMessage();
}
In above code if condition is not satisfied then it will throw exception and which gets caught by catch block and show the error message.
Also in PHP:
- create new laravel project composer
- $testing_recipient_email_list = str_replace('@', "+{$recipient}@", $testing_recipient_email);
- Installation request for pokemon-tcg/pokemon-tcg-sdk-php ^1.2 -> satisfiable by pokemon-tcg/pokemon-tcg-sdk-php[1.2.0]
- add 1 day current fasy php
- apt install php7.4-mbstring php7.4-zip php7.4-xml
- create laravel project using cmd
- changer le format d'une date php
- Syntax error or access violation: 1071 Specified key was too long; max key length is 3072 bytes laravel string length 1000
- all uppercase php
- check value present in string php
- errors register
- advance custon feilds
- case statement in php
- ->with()->where laravel
- exceptions (throwing | catching) in php
- find days with name between two dates in php
- captial php
- /phpspreadsheet 1.15.0 requires ext-dom * centos yum
- check if array has only the given key on php
- can php create folders
- change php format time
- 4random numbers php
- clearing cache on live site laravel
- 0 == "string" php