Example #1
0
 public function testFlattenArray()
 {
     $test['a'] = 1;
     $test['b']['c'] = 2;
     $test['b']['d'] = 3;
     $test['e']['f']['g'] = 4;
     $this->assertEquals(['a' => 1, 'b.c' => 2, 'b.d' => 3, 'e.f.g' => 4], Misc::flattenArray($test));
     $this->assertEquals(['a' => 1, 'b-c' => 2, 'b-d' => 3, 'e-f-g' => 4], Misc::flattenArray($test, '-'));
     $this->assertEquals(['test_a' => 1, 'test_b.c' => 2, 'test_b.d' => 3, 'test_e.f.g' => 4], Misc::flattenArray($test, '.', 'test_'));
 }