예제 #1
0
 public function testRepeat()
 {
     $array = CArray::repeat("a", 5);
     $this->assertTrue(CArray::equals($array, CArray::fromElements("a", "a", "a", "a", "a")));
 }
예제 #2
0
 /**
  * Repeats an element for a specified number of times and returns the resulting array.
  *
  * For instance, an element of "a" repeated three times would result in an array of "a", "a", "a".
  *
  * @param  mixed $element The element to be repeated.
  * @param  int $times The length of the resulting array.
  *
  * @return CArrayObject The resulting array.
  */
 public static function repeat($element, $times)
 {
     return self::fromSplArray(CArray::repeat($element, $times));
 }