class Person { public $name; public $age; } $john = new Person(); echo "The class of john object is " . get_class($john);
class Animal { public function eat() { echo "I'm eating..."; } } class Dog extends Animal { public function bark() { echo "Woof!"; } } $fluffy = new Dog(); echo "The parent class of Dog is " . get_parent_class($fluffy);
namespace MyNamespace; class MyClass { public function myFunction() { echo "Hello World!"; } } $myObject = new MyClass(); echo "The package library of MyClass is " . get_namespace($myObject);Output: The package library of MyClass is MyNamespace In these examples, the package library of the classes is determined by using the namespace keyword, which allows developers to organize their code into logical groups or libraries. Therefore, the package library of the MyClass class in Example 3 is MyNamespace.