How can one access a specific property within an object in PHP?
To access a specific property within an object in PHP, you can use the arrow (->) operator followed by the property name. This allows you to retrieve the value of that particular property from the object. Make sure the object is instantiated and the property exists within the object. Example:
// Instantiate an object
$obj = new stdClass();
$obj->name = 'John';
$obj->age = 30;
// Accessing a specific property within the object
echo $obj->name; // Output: John