Page 1 of 1

Proper way to create a blank object

Posted: Sun Apr 09, 2006 8:50 pm
by Todd_Z
I know that there are several ways to create an empty object, but which one is the best/most proper?

Code: Select all

$obj = new stdClass();
$obj = (object) null;
Should either of the above be used?

Posted: Sun Apr 09, 2006 9:08 pm
by feyd
the first one is most proper.

Posted: Sun Apr 09, 2006 9:32 pm
by Todd_Z
whats behind the scenes in both cases?