views:

16

answers:

1

Hi,

The code is:

error_reporting(E_ALL);

$user->username = "new user";
echo $user->username;

I expect some error or warning, but I get none - why?

+5  A: 
error_reporting(E_ALL | E_STRICT);

Will give: "PHP Strict Standards: Creating default object from empty value"

In PHP 5 a new error level E_STRICT is available. As E_STRICT is not included within E_ALL you have to explicitly enable this kind of error level. Enabling E_STRICT during development has some benefits. STRICT messages will help you to use the latest and greatest suggested method of coding, for example warn you about using deprecated functions.

http://php.net/manual/en/errorfunc.configuration.php

konforce
yossi