Wrox Programmer Forums
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 19th, 2005, 12:15 PM
Registered User
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Try and Catch?

Hi, I am casting a string as an (int) but am unable to use try {} catch{} statements, just wondering if there is such a thing in PHP? this is the error i am getting:
Parse error: parse error, unexpected '{' in /home/.../public_html/addTestCase.php on line 4

what does it mean? how do i fix it?
thankx for the help!

Old January 19th, 2005, 04:13 PM
Friend of Wrox
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts

Can you please post your code?

-Snib - http://www.snibworks.com
Where will you be in 100 years?
Old January 20th, 2005, 12:27 PM
Registered User
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

I found a way to get around having to use try and catch, using the '@' suppressant. This is what it looks like now:
$controlConfigId = @(int)$_POST["controlConfigId"] or exit ("<p>Please enter an integer value for Control ID. Returning to add a test case form!</p><META HTTP-EQUIV=\"Refresh\" CONTENT=\"3\"; URL=\"addTestCase.php\">");
Seems to work. Thankx anyway :)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Try...Catch lowell VB.NET 3 July 23rd, 2007 06:35 AM
Try/Catch/Finally rohit.sharma C# 2 January 12th, 2007 11:44 PM
catch the alerts catchrohith Classic ASP Basics 1 October 26th, 2006 06:39 AM
Try Catch not working?? dparsons ASP.NET 1.0 and 1.1 Professional 3 September 18th, 2006 06:54 PM
How to catch error. lancet2003 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 December 3rd, 2003 02:16 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.