Total members 10262 | Gratitudes |It is currently Thu May 24, 2012 5:39 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 2 posts ] 
Author Question
 Question subject: Understanding PHP error messages
PostPosted: Sat Dec 04, 2010 4:49 pm 
Offline
Newbie
User avatar

Joined: Thu Nov 18, 2010 11:56 am
Posts: 49
Has thanked: 0 time
Have thanks: 15 time

There are seven main categories of error, presented here in descending order of importance: :Dash: :Dash: :Dash:
    Fatal error: Any HTML output preceding the error will be displayed, but once the error is encountered—as the name suggests—everything else is killed stone dead. A fatal error is normally caused by referring to a nonexistent file or function.
    Recoverable error: This type of error occurs only when a particular type of error known as an exception is thrown. The error message contains much detail, explaining the cause and location of the problem, but it can be difficult for beginners to understand. To avoid recoverable errors, use try and catch blocks as described in “Handling exceptions.”
    Parse error: This means there s a mistake in your code syntax, such as mismatched quotes or a missing semicolon or closing brace. It stops the script in its tracks, and it doesn t even allow any HTML output to be displayed.
    Warning: This alerts you to a serious problem, such as a missing include file. However, the error is not serious enough to prevent the rest of the script from being executed.
    Deprecated: Introduced in PHP 5.3.0, this warns you about features that are scheduled to be removed from the next major version of PHP. If you see this type of error message, you should seriously consider updating your script, as it could suddenly stop working if your server is upgraded.
    Strict: This type of error message warns you about using techniques that are not considered good practice.
    Notice: This advises you about relatively minor issues, such as the use of a non declared variable. Although this type of error won t stop your page from displaying (and you can turn off the display of notices), you should always try to eliminate them. Any error is a threat to your output.


Handling exceptions in PHP5

If you are a Java Programmer, you find this is little bit familiar. PHP5 use try and catch exception handling method.
When a problem arises, many built-in classes automatically throw an exception—or generate a special type of object that contains details of what caused the error and where it arose. You can also throw custom exceptions, using the keyword throw like this:
Code:
if ( error occurs ) {
throw new Exception('Houston, we have a problem');
}

Code:
try {
// main script goes here
} catch (Exception $e) {
echo $e->getMessage();
}

_________________
Coding my life with Java, PHP, JavaScript, and Python



For this message the author isuru has received gratitude : msi_333
TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Understanding PHP error messages
PostPosted: Sun Dec 05, 2010 11:32 am 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2279
Location: Earth
Has thanked: 39 time
Have thanks: 61 time
@isuru

Great topic .

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 2 posts ] 
Quick reply


  

 Similar topics
 HELP :Novel error tolerant method AES for satelite imgaes
 ERROR
 error closing file matlab save
 error in code
 AJAX SYNTAX ERROR IE
 error in inserting record
 Java download error
 tell the meaning of the error
 Java error
 How do I use php in my 404 error page for my site?

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team