note 123268 deleted from function.array-key-first by cmb

From: Date: Wed, 08 May 2019 09:50:03 +0000
Subject: note 123268 deleted from function.array-key-first by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-210985@lists.php.net to get a copy of this message
Note Submitter: @manzoorwanijk ---- For PHP < 7.3.0 : <?php if ( ! function_exists( 'array_key_first' ) ) { /** * Polyfill for array_key_first() function added in PHP 7.3. * * Get the first key of the given array without affecting * the internal array pointer. * * @param mixed $array An array * * @return mixed The first key of array if the array is not empty; NULL otherwise. */ function array_key_first( $array ) { $key = null; if ( is_array( $array ) ) { foreach ( $array as $key => $value ) { break; } } return $key; } } ?>

« previous php.notes (#210985) next »