Possible Duplicate:
Initialize class property with an anonymous function
I've been programing PHP for quite a while, and PHP 5.3 anonymous functions are one of those thinks that help you out a lot while building some simple scripts. However, I cannot understand why would the following example won't work?
$db = new PDO([..]);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$db->die = function($str){ die(var_dump( $str )); };
$db->die('[..]');
After all, all I do is declare anonymous function on ->die property of PDO instance. This kinda makes me think this is a PHP bug.