• PHP Video Tutorials

PHP - Ds Sequence set() Function


Advertisements

Ds\Sequence::set() function can update a value at the given index.

Syntax

public abstract void Ds\Sequence::set( int $index , mixed $value )

Ds\Sequence::set() function doesn't return any value, and throw OutOfRangeException if an index is not valid.

Example 1

<?php
   $seq = new \Ds\Vector(["a", "b", "c"]);
   $seq->set(1, "_");
   
   print_r($seq);
?>

Example 2

<?php
   $seq = new \Ds\Vector(["a", "b", "c"]);
   $seq[1] = "_";
   
   print_r($seq);
?>
php_function_reference.htm
Advertisements