Getting Started with Objects with PHP V5
By Matt Zandstra2005-07-01
A first class
class keyword. At its simplest, a class consists of the keyword class, a name, and a code block: |
The class name can contain any combination of letters and numbers, as well as the underscore character, but cannot begin with a number.
The Dictionary class in the previous example is perfectly legal, even if it is of limited use. So how do you use this class to create some objects?
|
In form at least, instantiating an object is similar to calling a function. As with a function call, you must supply parentheses. Like functions, some classes require that you pass them arguments. You must also use the new keyword. This tells the PHP engine that you wish to instantiate a new object. The returned object can then be stored in a variable for later use.
Tutorial pages:
|
First published by IBM DeveloperWorks
|
|||||||||
You might also want to check these out:
|
Leave a Comment on "Getting Started with Objects with PHP V5"
You must be logged in to post a comment.
Link to This Tutorial Page!

