Question
How error handling is being handled by PHP

Answers

Error handling is very important in every programming language. PHP uses the trigger to print the error in a program. The example statement is given below:If ($height_of_door > $height_of_house){     trigger_error(“Impossible condition”,E_USER_ERROR); }The E_USER_ERROR in the statement tells PHP that the condition is an error. Impossible condition is a string message which is displayed when an error is encountered. If the condition comes out to be true then the following message is displayed:Fatal error: Impossible conditionE_USER_WARNING or E_USER_NOTICE can be used instead of E_USER_ERROR, to have PHP treat the condition as a warning or notice. Own statements can be written to perform error handling actions such as send a message, log a message or stop the script. For example: If ($height_of_door > $height_of_house){    echo “This is impossible
”;    exit();}If $height_of_door is larger than $height_of_house, the message is echoed, and exit() stops the script. Die statement can be used to display an error message when a function fails.   Your Comment






Search
Can you Answer!!
  • Q What are integrity constraints?
  • Q Wavelength of which of the following colours of the visible spectrum of light are maximally absorbed by green plants-
  • Q In 1935 Charlton C McGee invented what in the USA
  • Q Library Files or VBScript Files How do we associate a library file with a test ?
  • Q Where else are you interviewing?
  • Q 'Right to equal opportunity for justice and free legal aid was added to Directive Principles through _____ amendment.
  • Q The Election Commission is responsible for the conduct of elections to
  • Q Which badminton pair won Men's doubles at 2017 Uganda International series?
  • Q Explain multiple learning styles.
  • Q What was the last thing you dressed up as for fancy dress?
  • Q What vitamin can cure Alzheimer’s desease?