Esempio n. 1
0
 public function testHeadKeyLastKey()
 {
     $this->assertEquals('a', Arrays::firstKey(['a' => 0, 'b' => 1]));
     $this->assertEquals('b', Arrays::lastKey(['a' => 0, 'b' => 1]));
     $this->assertEquals(null, Arrays::firstKey([]));
     $this->assertEquals(null, Arrays::lastKey([]));
 }
Esempio n. 2
0
 /**
  * Returns the last key of an array.
  *
  * @param    array       Array to retrieve the last key from.
  *
  * @return   int|string  The last key of the array.
  * @group util
  *
  * @deprecated
  */
 function last_key(array $arr)
 {
     return \Packaged\Helpers\Arrays::lastKey($arr);
 }