expandList() 공개 정적인 메소드

Opposite of flattenList(). It needs at least a single separator to be present in all values as the key would otherwise be undefined. If data can contain such key-less rows, use $undefinedKey to avoid an exception being thrown. But it will effectivly collide with other values in that same key then. So Some.Deep.Value becomes array('Some' => array('Deep' => array('Value'))).
public static expandList ( array $data, string $separator = '.', string | null $undefinedKey = null ) : array
$data array
$separator string
$undefinedKey string | null
리턴 array
예제 #1
0
 /**
  * UtilityTest::testExpandListWithKeyLessList()
  *
  * @return void
  */
 public function testExpandListWithKeyLessList()
 {
     $is = ['Some', 'Thing', '.EmptyString'];
     $result = Utility::expandList($is, '.', '');
     $expected = ['' => ['Some', 'Thing', 'EmptyString']];
     $this->assertSame($expected, $result);
 }