What are best practices for initializing attributes with specific values in PHP objects, especially when dealing with empty objects?

When initializing attributes with specific values in PHP objects, especially when dealing with empty objects, it is best practice to define default values for the attributes in the object's constructor. This ensures that the object is properly initialized with the desired values, even if no values are provided during instantiation.

class User {
    public $name;
    public $age;

    public function __construct($name = 'John Doe', $age = 30) {
        $this->name = $name;
        $this->age = $age;
    }
}

$user = new User();
echo $user->name; // Output: John Doe
echo $user->age; // Output: 30