How to get the first key of an associative array in PHP?
Hello everyone! I'm a beginner in PHP and encountered a problem when working with associative arrays. I need to get the first key of the array, but I don't know how to do it correctly.
The situation: I have an array that can be either a regular indexed array (with numeric keys) or an associative array (with string keys). For example:
```php
$arr1 = ["apple", "banana", "cherry"]; // indexed
$arr2 = ["name" => "John", "age" => 30, "city" => "New York"]; // associative
```
I need to write a function that returns the first key of the array regardless of its type. The problem is that I don't know which array will be passed to me. I tried using `array_keys()` and taking the element with index `[0]`, but this doesn't always work, especially if the array doesn't start with a zero index. I also tried `r