• PHP Video Tutorials

PHP - Ds Sequence push() Function


Advertisements

Ds\Sequence::push() function can add values to the end of a sequence.

Syntax

public abstract void Ds\Sequence::push([ mixed $...values ] )

Ds\Sequence::push() function doesn't return any value.

Example 1

<?php 
   $seq =  new \Ds\Vector([10, 15, 20, 25]); 
   $seq->push(24);
   $seq->push("A"); 
   $seq->push("World"); 
   $seq->push(15); 
  
   var_dump($seq); 
?> 

Example 2

<?php 
   $seq = new \Ds\Vector([12, 15, 18, 20]); 
   $arr = array ("r", "a", "j", "a"); 
   foreach($arr as $val) {   
      $seq->push($val); 
   } 
   var_dump($seq); 
?> 
php_function_reference.htm
Advertisements