Example #1
0
 public function testUnshift()
 {
     $array = CArray::fromElements("a", "b", "c");
     $newLength = CArray::unshift($array, "d");
     $this->assertTrue(CArray::equals($array, CArray::fromElements("d", "a", "b", "c")));
     $this->assertTrue($newLength == 4);
 }
Example #2
0
 /**
  * Adds an element to the start of an array.
  *
  * @param  mixed $element The element to be added.
  *
  * @return int The array's new length.
  */
 public function unshift($element)
 {
     return CArray::unshift($this->m_splArray, $element);
 }