I have an object with a single key and its value. But I don\'t know the key to access it. What is the most efficient way to get the key without enumerating the object?
$array = array("foo" => "bar"); $keys = array_keys($array); echo $keys[0]; // Output: foo
See: http://php.net/manual/en/function.array-keys.php