splice() публичный Метод

Splice portion of the underlying collection array.
public splice ( integer $offset, integer $length, mixed $replacement = [] ) : Collection
$offset integer
$length integer
$replacement mixed
Результат Collection
Пример #1
0
 public function testSplice()
 {
     $data = new Collection(array('foo', 'baz'));
     $data->splice(1, 0, 'bar');
     $this->assertEquals(array('foo', 'bar', 'baz'), $data->all());
     $data = new Collection(array('foo', 'baz'));
     $data->splice(1, 1);
     $this->assertEquals(array('foo'), $data->all());
     $data = new Collection(array('foo', 'baz'));
     $cut = $data->splice(1, 1, 'bar');
     $this->assertEquals(array('foo', 'bar'), $data->all());
     $this->assertEquals(array('baz'), $cut->all());
 }