You are here

public static function WebformArrayHelper::getLastKey in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Utility/WebformArrayHelper.php \Drupal\webform\Utility\WebformArrayHelper::getLastKey()

Get the last key in an array.

Parameters

array $array: An array.

Return value

string|null The last key in an array.

2 calls to WebformArrayHelper::getLastKey()
WebformArrayHelperTest::testGetKey in tests/src/Unit/Utility/WebformArrayHelperTest.php
Tests navigating an associative array's keys.
WebformSubmissionForm::getLastPage in src/WebformSubmissionForm.php
Get last page's key.

File

src/Utility/WebformArrayHelper.php, line 111

Class

WebformArrayHelper
Provides helper to operate on arrays.

Namespace

Drupal\webform\Utility

Code

public static function getLastKey(array $array) {
  $keys = array_keys($array);
  return end($keys);
}