note 123503 added to function.array-key-first

From: Date: Wed, 09 Jan 2019 12:00:27 +0000
Subject: note 123503 added to function.array-key-first
Groups: php.notes 
Request: Send a blank email to php-notes+get-210024@lists.php.net to get a copy of this message
It's much simpler than the examples already posted by other users (without ridiculous foreach cycles, LoL). 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) { return $array ? array_keys($array)[0] : null; } ---- Server IP: 208.43.231.9 Probable Submitter: 2a02:cb44::239 (proxied: 109.239.245.211) ---- Manual Page -- http://php.net/manual/en/function.array-key-first.php Edit -- https://master.php.net/note/edit/123503 Del: integrated -- https://master.php.net/note/delete/123503/integrated Del: useless -- https://master.php.net/note/delete/123503/useless Del: bad code -- https://master.php.net/note/delete/123503/bad+code Del: spam -- https://master.php.net/note/delete/123503/spam Del: non-english -- https://master.php.net/note/delete/123503/non-english Del: in docs -- https://master.php.net/note/delete/123503/in+docs Del: other reasons-- https://master.php.net/note/delete/123503 Reject -- https://master.php.net/note/reject/123503 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#210024) next »