• PHP Video Tutorials

PHP - Ds Vector shift() Function



Ds\Vector::shift() function can remove and return the first value.

Syntax

public mixed Ds\Vector::shift( void )

Ds\Vector::shift() function doesn't have any parameters. This function can return the first value that was removed.

Ds\Vector::shift() function can throw UnderflowException if empty.

Example

<?php
   $vector = new \Ds\Vector(["a", "b", "c"]);

   var_dump($vector->shift());
   var_dump($vector->shift());
   var_dump($vector->shift());
?>
php_function_reference.htm
Advertisements