note 86817 added to language.oop5
| From: | secure_admin at osu1 dot php dot net | Date: | Wed, 05 Nov 2008 01:43:56 +0000 |
| Subject: | note 86817 added to language.oop5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146148@lists.php.net to get a copy of this message | ||
CREATE NEW TYPES OF OBJECTS
The PHP Core Language provides objects of type [String], [Number], [Array], etc and makes them
available to every script you write automatically. BUT, when you need objects of a more specialized
nature (for portability, extendability, maintainability, whatever the reason), you can create them
easily by writing a PHP Class Definition - which literally creates new "types" of objects
for you on-the-spot.
<?php
class Customer {
// define an object of "type" [Customer].
}
class Item {
// define an object of "type" [Item].
}
class ShoppingCart {
// define an object of "type" [ShoppingCart].
}
?>
Now, assuming the "class defs" above have been filled-in to your satisfaction, included,
imported, and/or loaded into our script somehow, we'll now have these "types of
objects" to work with:
[String] - provided by PHP automatically
[Number] - provided by PHP automatically
[Array] - provided by PHP automatically
[Customer] - defined above
[Item] - defined above
[ShoppingCart] - defined above
As you can see, we now have six(6) types of objects to work with, verses the three(3) we would have
normally been stuck with.
----
Server IP: 69.147.83.197
Probable Submitter: 67.150.126.79
----
Manual Page -- http://www.php.net/manual/en/language.oop5.php
Edit -- https://master.php.net/note/edit/86817
Del: integrated -- https://master.php.net/note/delete/86817/integrated
Del: useless -- https://master.php.net/note/delete/86817/useless
Del: bad code -- https://master.php.net/note/delete/86817/bad+code
Del: spam -- https://master.php.net/note/delete/86817/spam
Del: non-english -- https://master.php.net/note/delete/86817/non-english
Del: in docs -- https://master.php.net/note/delete/86817/in+docs
Del: other reasons-- https://master.php.net/note/delete/86817
Reject -- https://master.php.net/note/reject/86817
Search -- https://master.php.net/manage/user-notes.php