Object Properties : Objects « Class « PHP

Object Properties

class Item {
  var $name = "item";

$obj1 = new Item();
$obj2 = new Item();
$obj1->name = "widget 5442";
print "$obj1->name<br />";
print "$obj2->name<br />";


Related examples in the same category

1.Comparing Objects with == and ===
2.Create a new class and create an instance then use its property and method
3.Object Initialization
4.Object Overloading
5.Object Type Information
6.Objects Within Objects
7.Creating a new object and assigning it to a variable