stdclass - PHP strict standards: is this bad? -


when create standard class do:

$test = null; $test->id = 1; $test->name = 'name'; 

however in strict-mode error.

so correct way of doing is:

$test = new stdclass(); $test->id = 1; $test->name = 'name'; 

so wondering:

is big no-no do: $test = null; want?

what gain conforming strict standards? make sure code keep on working in future versions? better backwards compatible? matter of best practice? else?

edit typo

is big no-no do: $test = null; want?

yes.

it's allowed because php loose, turning on strict mode gives god's-honest truth.

what gain conforming strict standards? make sure code keep on working in future versions? better backwards compatible? matter of best practice?

yes.

something else?

it's right.


Comments

Popular posts from this blog

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -

java - Why is BlockingQueue.take() not releasing the thread? -

jQuery Ajax Render Fragments OR Whole Page -