note 123291 deleted from function.array-key-first by cmb
| From: | cmb@php.net | Date: | Thu, 01 Nov 2018 11:51:44 +0000 |
| Subject: | note 123291 deleted from function.array-key-first by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209574@lists.php.net to get a copy of this message | ||
Note Submitter: VitalyArt
----
For PHP < 7.3.0
<?php
if (!function_exists('array_key_first')) {
/**
* Gets the first key of an array
*
* @param array $array
* @return mixed
*/
function array_key_first(array $array)
{
if (count($array)) {
reset($array);
return key($array);
}
return null;
}
}