You are here

public static function WebformArrayHelper::getFirstKey in Webform 6.x

Same name and namespace in other branches
  1. 8.5 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::initialize in src/WebformSubmissionListBuilder.php
Initialize WebformSubmissionListBuilder object.

File

src/Utility/WebformArrayHelper.php, line 112

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);
}