My First PHP Class

Coding Critique is the place to post source code for peer review by other members of DevNetwork. Any kind of code can be posted. Code posted does not have to be limited to PHP. All members are invited to contribute constructive criticism with the goal of improving the code. Posted code should include some background information about it and what areas you specifically would like help with.

Popular code excerpts may be moved to "Code Snippets" by the moderators.

Moderator: General Moderators

User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: My First PHP Class

Post by Christopher »

It is better not to just die, but generate an error page that helps the user resolve the problem.
(#10850)
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: My First PHP Class

Post by Eran »

Using the die() command to handle errors is a very bad practice. It leaves no room for error handling
matthewcl375
Forum Newbie
Posts: 8
Joined: Wed Jul 30, 2008 1:35 pm

Re: My First PHP Class

Post by matthewcl375 »

Oh i only recommended it as in the book that i learned PHP from it uses it a lot.

Thanks for the advice :D
thinsoldier
Forum Contributor
Posts: 367
Joined: Fri Jul 20, 2007 11:29 am
Contact:

Re: My First PHP Class

Post by thinsoldier »

pytrin wrote:Using the die() command to handle errors is a very bad practice. It leaves no room for error handling
What about throwing exceptions?
Warning: I have no idea what I'm talking about.
Post Reply