PluginProbe
Authorizer / 3.6.0
Authorizer v3.6.0
3.15.3 3.15.2 3.15.1 3.15.0 3.14.3 3.14.4 3.14.2 3.14.1 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.10 2.9.11 2.9.12 2.9.13 2.9.2 2.9.3 2.9.6 All 126 releases
← All changes | polyfills.php +14 -23 3.15.03.6.0 View file →
@@ -1,34 +1,25 @@
1 1 <?php
2 +
2 3 /**
3 - * Authorizer
4 + * Polyfill for array_key_last(), used in class-cas.php. Not available in PHP
5 + * versions below 7.3.
4 6 *
5 - * @license GPL-2.0+
6 - * @link https://github.com/uhm-coe/authorizer
7 - * @package authorizer
7 + * Get the last key of the given array without affecting the internal array
8 + * pointer.
9 + *
10 + * @param array $array An array.
11 + *
12 + * @return mixed The last key of array if the array is not empty; NULL otherwise.
8 13 */
9 -
10 -// Prevent direct access.
11 -defined( 'ABSPATH' ) || exit;
12 -
13 14 if ( ! function_exists( 'array_key_last' ) ) {
14 - /**
15 - * Polyfill for array_key_last(), used in class-cas.php. Not available in PHP
16 - * versions below 7.3.
17 - *
18 - * Get the last key of the given array without affecting the internal array
19 - * pointer.
20 - *
21 - * @param array $arr An array.
22 - *
23 - * @return mixed The last key of array if the array is not empty; NULL otherwise.
24 - */
25 - function array_key_last( $arr ) {
15 + function array_key_last( $array ) {
26 16 $key = null;
27 - if ( is_array( $arr ) ) {
28 - end( $arr );
29 - $key = key( $arr );
17 + if ( is_array( $array ) ) {
18 + end( $array );
19 + $key = key( $array );
30 20 }
31 21
32 22 return $key;
33 23 }
34 24 }
25 +