I see the variable $this
in PHP all the time and I have no idea what it\'s used for. I\'ve never personally used it.
Can someone tell me how the variab
It's a reference to the current object, it's most commonly used in object oriented code.
Example:
name = $name;
}
};
$jack = new Person('Jack');
echo $jack->name;
This stores the 'Jack' string as a property of the object created.