note 18100 deleted from reserved by philip
| From: | philip@php.net | Date: | Sat, 19 Jan 2002 07:13:02 +0000 |
| Subject: | note 18100 deleted from reserved by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25120@lists.php.net to get a copy of this message | ||
Creating objects dynamically (without a class definition) can be accomplished using the stdClass
keyword.
ie.:
--<snip>--
// instantiate a new object
$oNewObject = new stdClass;
// graft a few properties onto it
$oNewObject->sFirstName = 'Andre';
$oNewObject->sEmailAddress = 'andre@fscinternet.com';
$oNewObject->iFooBar = 12345;
// display the object in it's current state
print_r( $oNewObject );
--<snip>--
Will give you the following:
stdClass Object
(
[sFirstName] => Andre
[sEmailAddress] => andre@fscinternet.com
[iFooBar] => 12345
)
Note: Using PHP v4.0.6. No guarantees about how far back or forward this'll go.
**I love this language! :)**