A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearBest way to implement try catch in php4 - page 1
User InfoPosts
Best way to implement try catch in php4#1
What is the closest you can get to a try-catch block in php4?

I(m in the middle of a callback during an xmlrpc request and it(s required to return a specifically structured array no matter what.

I have to error check all accesses to external resources, resulting in a deep stack of nested if-else blocks, ugly.

posted date: 2009-04-13 12:09:00


Re: Best way to implement try catch in php4#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-13 12:09:01


Re: Best way to implement try catch in php4#3
gophp5.org

posted date: 2009-04-13 12:40:00


Re: Best way to implement try catch in php4#4
If you're writing new code, write it for PHP5. There is no try/catch (exception) in PHP4.

posted date: 2009-04-14 05:19:00


Re: Best way to implement try catch in php4#5
Late answer, I realise, sorry. I hope this is still relevant for you:First, I(m echoing the comments your got in response to your post. PHP5 is the way to go.However:I(m in the middle of a callback during an xmlrpc request and it(s required to return a specifically structured array no matter what.If you can vouch for that the program cannot possibly continue without getting a structured array back, and you absolutely have to work with PHP4, then an exit() or die() with detailed error information will get you much the same effect as a fatal exception would.That(s far removed from being graceful, of course. If you want something catchable, then return values and if-checking the result are your best bet, unfortunately. There are some standard ways of passing back specific error objects, but it(s still the same thing - return the error object, if-check whether the result was an error object, react.Still, take a look at PEAR(s error object.

posted date: 2010-03-19 09:03:00


Re: Best way to implement try catch in php4#6
Maybe you should upvote the answer if you think it's worth of being "the answer"

posted date: 2010-03-26 04:06:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.