Can someone please explain what a php object is. I am familiar with variables in php and some functions. I simply need to understand what exactly a php object is.
What is a php object -- give an example snippet?
The simple answer is that everything is an object. The object model was revamped for PHP 5 allowing for more features and performance.
Reply:Many thanks for answering, I have not been around -- missed the answer. Thanks again. Report It
Reply:php object is like an programing language in java, it like a group of function so u must declared every function and group it on an object, example is like connection object :
in the connection object it will contains :
1. connection function
2. add function
3. delete function
4. update function
5. etc
Reply:You need to research the concepts of object oriented programming (OOP).
An object is, as one of the previous answers says, an object. It can be anythings. The key thing about OOP is that objects have properties and methods. Poperties are the variables for each object, and the ethods are the functions that each object can do.
Objects are created from classes, which are basically a template for an object.
e.g.
class person
{
var $name;
var $height;
function breathe()
{
//do stuff here
}
}
You would then create an object by creating a 'new' instance of this class.
$Bob = new person;
$Bob-%26gt;$name = "Bob";
$Bob-%26gt;$height = 185;
Now you have an object called $Bob, with height and name properties defined.
This is a very simple example, make sure you understand the concepts of classes and objects first.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment