JBZoo\Utils\Arr::firstKey PHP Method

firstKey() public static method

Returns the first key in an array.
public static firstKey ( array $array ) : integer | string
$array array
return integer | string
    public static function firstKey(array $array)
    {
        reset($array);
        return key($array);
    }

Usage Example

コード例 #1
0
ファイル: ArrayTest.php プロジェクト: jbzoo/utils
 public function testFirstKey()
 {
     $test = array('a' => array('a' => 'b', 'c' => 'd'));
     is('a', Arr::firstKey(Vars::get($test['a'])));
 }