• PHP Video Tutorials

PHP - Ds Sequence remove() Function


Advertisements

Ds\Sequence::remove() function can remove and return a value by index.

Syntax

public abstract mixed Ds\Sequence::remove( int $index )

Ds\Sequence::remove() function can return a value that has removed. This function can throw OutOfRangeException if an index is not valid.

Example 1

<?php 
   $seq = new \Ds\Vector(["Adithya", "Jai", "TRR"]); 
     
   var_dump($seq->remove(2)); 
   var_dump($seq->remove(0)); 
?>

Example 2

<?php 
   $seq = new \Ds\Vector([2, 6, 10, 14, 18, 20]); 
   $seq->remove(5); 
   $seq->remove(3); 
   $seq->remove(2); 
   $seq->remove(0); 
   
   var_dump($seq->remove(1)); 
?>
php_function_reference.htm
Advertisements