$person = ['name' => 'John Doe', 'age' => 23]; $name = getKV($person, 'name'); echo $name; // Output: John Doe
class User { private $data = []; public function __construct($name, $email) { $this->data['name'] = $name; $this->data['email'] = $email; } public function get($key) { return getKV($this->data, $key); } } $user = new User('John Doe', 'johndoe@example.com'); $name = $user->get('name'); echo $name; // Output: John DoeIn this example, we create a `User` class that stores user data in a key-value pair array called `$data`. We then define a `get` method that uses `getKV` to retrieve the value stored under the supplied key. This example demonstrates how `getKV` can be used in an object-oriented context. It is difficult to determine the package library of `getKV` without additional context. It is possible that it is a custom function created by the programmer.