public function testFlatten() { $list = array(1, array(2), array(3, array(array(array(4))))); // from js $this->assertEquals(array(1, 2, 3, 4), __u::flatten($list), 'can flatten nested arrays'); $this->assertEquals(__u::flatten($list, true), array(1, 2, 3, array(array(array(4)))), 'can shallowly flatten nested arrays'); $func = function () { return __u::flatten(func_get_args()); }; $result = $func(1, array(2), array(3, array(array(array(4))))); $this->assertEquals(array(1, 2, 3, 4), $result, 'works with arguments'); // docs $list = array(1, array(2), array(3, array(array(4)))); $this->assertEquals(array(1, 2, 3, 4), __u::flatten($list)); $this->assertEquals(array(1, 2, 3, array(array(4))), __u::flatten($list, true)); }