very simple question!

Hi,

I was wondering if someone could help please? I’m new to php and have been asked to look at someone else’s project. Littered throughout the project are things like $this->. Could someone help me with what the -> means please? I know it’s probably basic stuff.

thanks,

kevin

Hi it is object oriented programming.
Default property values
Properties can have default values. Bound to the class not to the object. Default values cannot be changed but overwritten.
classObject {
var$prop =“Hello\n”;
}
$obj1 = newObject;
$obj1->prop =“Hello World\n”;
$obj2 = newObject;
echo $obj2->prop; // HelloClass

Try this example and you will have the idea. also search for “object oriented programming in php” and will get many tutorials about it.

Hope you find it helpful

Sponsor our Newsletter | Privacy Policy | Terms of Service