public function testMake() { $array = CArray::make(); $this->assertTrue($array->getSize() == 0); $array = CArray::make(10); $this->assertTrue($array->getSize() == 10); $array = CArray::makeDim2(2, 3); $this->assertTrue($array->getSize() == 2 && $array[0]->getSize() == 3 && $array[1]->getSize() == 3); $array = CArray::makeDim3(2, 3, 2); $this->assertTrue($array->getSize() == 2 && $array[0]->getSize() == 3 && $array[1]->getSize() == 3 && $array[0][0]->getSize() == 2 && $array[0][1]->getSize() == 2 && $array[0][2]->getSize() == 2); $array = CArray::makeDim4(2, 3, 2, 1); $this->assertTrue($array->getSize() == 2 && $array[0]->getSize() == 3 && $array[1]->getSize() == 3 && $array[0][0]->getSize() == 2 && $array[0][1]->getSize() == 2 && $array[0][2]->getSize() == 2 && $array[0][0][0]->getSize() == 1 && $array[0][0][1]->getSize() == 1); }
/** * Creates a three-dimensional OOP array. * * @param int $lengthDim1 The length of the array at the first level. * @param int $lengthDim2 The length(s) of the array(s) at the second level. * @param int $lengthDim3 **OPTIONAL. Default is** `0`. The length(s) of the array(s) at the third level. * * @return CArrayObject The new array. */ public static function makeDim3($lengthDim1, $lengthDim2, $lengthDim3 = 0) { return to_oop(CArray::makeDim3($lengthDim1, $lengthDim2, $lengthDim3)); }