arrayShiftKeys() 공개 정적인 메소드

Similar to array_shift but on the keys of the array like array_shift() only for keys and not values
public static arrayShiftKeys ( array &$array ) : string
$array array keyValuePairs
리턴 string key
예제 #1
0
 /**
  * UtilityTest::testArrayShiftKeys()
  *
  * @covers ::arrayShiftKeys
  * @return void
  */
 public function testArrayShiftKeys()
 {
     $array = ['a' => 1, 'b' => ['c' => ['d' => ['f' => 'g', 'h' => true]]], 'k' => 'm'];
     $res = Utility::arrayShiftKeys($array);
     $expected = 'a';
     $this->assertSame($expected, $res);
     $expected = ['b' => ['c' => ['d' => ['f' => 'g', 'h' => true]]], 'k' => 'm'];
     $this->assertSame($expected, $array);
 }