News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
PHP-Coding-Practices.com:
Try-Catch Syntax Weirdness
June 22, 2007 @ 13:28:00

In working with his code recently, Tim Koschuetzki noticed something odd with a block of try/catch code:

I just noticed today, that PHP's try catch blocks require curly braces. Anybody has an idea why it is like that? I have used curly braces by default up until now, so I just stumbled upon this weirdness today.

He includes two examples, one with a curly brace after the catch clause and the other without. This is different than several other control structures (like ifs) that don't require the curly brace when there's only the one line following it.

1 comment voice your opinion now!
try catch curlybrace require try catch curlybrace require




Similar Posts

DevShed: Auto Loading Classes in PHP 5

PHP-Coding-Practices.com: Try-Catch Syntax Weirdness

Community News: The PDO v2 Proposal

Stefan Priebsch's Blog: Turning errors into exceptions

Alexander Netkachev's Blog: PHP coding tip: Convert notices and warnings into Exceptions


Community Events







Don't see your event here?
Let us know!


ajax code security developer framework database zendframework release PEAR releases book example application job cakephp PHP5 zend mysql package conference

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework