I ran across this today and it surprised me: $ php -r 'define("X", "stdClass"); $x = new X; var_dump($x);'; Fatal error: Cannot instantiate non-existent class: x in Command line code on line 1
I tested on php 4.4.0, 4.3.8 and 5.0.3, with the result that all versions exhibit the same behavior. Clearly there is an easy work around: $ php -r 'define("X", "stdClass"); $y = X; $x = new $y; var_dump($x);' object(stdClass)(0) { } But I was wondering if anyone could enlighten me as to why php would be upset interpreting the constant as the class name. Thanks. Regards, Jason http://blog.casey-sweat.us/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php