View Single Post
Old 06-25-2009, 02:13 PM   #9 (permalink)
sketchMedia
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Something else that I have just noticed.
Your use of a try .. catch block won't work as expected.
The reason being that array_splice doesn't throw an Exception therefore nothing will get caught.
PHP doesn't use the try catch like JavaScript does, JavaScript's try .. catch block catches errors but PHP behaves much like Java and will only catch an Exception.

PHP Code:
try 
{
    throw new 
Exception('This is an exception');
}
catch(
Exception $e)
{
    echo 
$e->getMessage();

You can fudge PHP to throw an exception on error/notice etc by using set_error_handler
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote