$user = new User(); $role = $user->getRole(); echo "The user's role is: " . $role;
class Base { public function getRole() { return "Base Role"; } } class User extends Base { // additional user methods here } $user = new User(); $role = $user->getRole(); echo "The user's role is: " . $role;Package/Library: This function is part of the core PHP language and does not require any external package or library.