PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Todd_Z
Forum Regular
Posts: 708 Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan
Post
by Todd_Z » Sun Apr 09, 2006 8:50 pm
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?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Apr 09, 2006 9:08 pm
the first one is most proper.
Todd_Z
Forum Regular
Posts: 708 Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan
Post
by Todd_Z » Sun Apr 09, 2006 9:32 pm
whats behind the scenes in both cases?