• PHP Video Tutorials

PHP - Ds Sequence contains() Function


Advertisements

Ds\Sequence::contains() function can determine if a sequence contains given values.

Syntax

public abstract bool Ds\Sequence::contains([ mixed $...values ] )

Ds\Sequence::contains() function can determine if a sequence contains all values.

Ds\Sequence:: contains() function can return false if any of the provided values are not in a sequence, or true otherwise.

Example

<?php
   $sequence = new \Ds\Vector(["a", "b", "c", 1, 2, 3]);
   
   var_dump($sequence->contains("a"));
   var_dump($sequence->contains("a", "b"));
   var_dump($sequence->contains("c", "d")); 
   var_dump($sequence->contains(...["c", "b", "a"])); 
   var_dump($sequence->contains(1));
   var_dump($sequence->contains("1"));
   var_dump($sequece->contains(...[]));  //  true
?>
php_function_reference.htm
Advertisements