arrayFlatten() 공개 정적인 메소드

Careful with this method. It can lose information. The keys will not be changed, thus possibly overwrite each other. TODO: check if it can be replace by Hash::flatten() or Utility::flatten().
public static arrayFlatten ( array $array, boolean $preserveKeys = false ) : array
$array array Array to flatten
$preserveKeys boolean
리턴 array
예제 #1
0
 /**
  * UtilityTest::testArrayFlattenAndPreserveKeys()
  *
  * @covers ::arrayFlatten
  * @return void
  */
 public function testArrayFlattenAndPreserveKeys()
 {
     $array = [0 => 1, 1 => ['c' => ['d' => ['g', 'h' => true]]], 2 => 'm'];
     $res = Utility::arrayFlatten($array, true);
     $expected = [0 => 'g', 'h' => true, 2 => 'm'];
     $this->assertSame($expected, $res);
 }