# authorizer/trunk/polyfills.php

Authorizer, version trunk. 35 lines.

- Page: https://pluginprobe.com/plugins/authorizer/trunk/code/polyfills.php
- Raw: https://pluginprobe.com/plugins/authorizer/trunk/raw/polyfills.php
- Modified: 2026-05-27T18:21:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/authorizer/trunk/code/polyfills.php#L10-L20`.

```php
<?php
/**
 * Authorizer
 *
 * @license  GPL-2.0+
 * @link     https://github.com/uhm-coe/authorizer
 * @package  authorizer
 */

// Prevent direct access.
defined( 'ABSPATH' ) || exit;

if ( ! function_exists( 'array_key_last' ) ) {
	/**
	 * Polyfill for array_key_last(), used in class-cas.php. Not available in PHP
	 * versions below 7.3.
	 *
	 * Get the last key of the given array without affecting the internal array
	 *  pointer.
	 *
	 * @param  array $arr An array.
	 *
	 * @return mixed The last key of array if the array is not empty; NULL otherwise.
	 */
	function array_key_last( $arr ) {
		$key = null;
		if ( is_array( $arr ) ) {
			end( $arr );
			$key = key( $arr );
		}

		return $key;
	}
}

```
