You are here

public static function WebformArrayHelper::getFirstKey in Webform 8.5

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

Get the first key in an array.

Parameters

array $array: An array.

Return value

string|null The first key in an array.

4 calls to WebformArrayHelper::getFirstKey()
WebformArrayHelperTest::testGetKey in tests/src/Unit/Utility/WebformArrayHelperTest.php
Tests navigating an associative array's keys.
WebformSubmissionForm::getCurrentPage in src/WebformSubmissionForm.php
Get the current page's key.
WebformSubmissionForm::getFirstPage in src/WebformSubmissionForm.php
Get first page's key.
WebformSubmissionListBuilder::__construct in src/WebformSubmissionListBuilder.php
Constructs a new WebformSubmissionListBuilder object.

File

src/Utility/WebformArrayHelper.php, line 97

Class

WebformArrayHelper
Provides helper to operate on arrays.

Namespace

Drupal\webform\Utility

Code

public static function getFirstKey(array $array) {
  $keys = array_keys($array);
  return reset($keys);
}