+

PHP Ds / Sequence contains () function

Syntax:
bool abstract public DsSequence::contains ([mixed $... values])
Parameter:this function accepts one or more values, which should check if the values ​​exist in the sequence or not.Returned value:if the value exists in sequence, it returns True, otherwise it returns False.The following programs illustrate the Ds / Sequence::contains()function in PHP:Program 1:  
// Create sequence $seq = new DsVector ([ `G` ,
`e` , ` e ` , ` k` , `s` , 5, 2, 7]);  
// Use the contains() function to check the elements
// exists in sequence or not var_dump ( $seq -> contains ( ` G` )) ; var_dump ( $seq -> contains ( ` k` ) ); var_dump ( $seq -> contains ( ` p` ) ); var_dump ( $seq -> contains (7)); var_dump ( $seq -> contains ( ` 5` ) );  
?>
Output:
bool (true) bool (true) bool (false) bool (true) bool (false)
Program 2:  
/ / Create sequence $seq = new DsVector ([ `G` , `e` , ` e` , `k` , ` s` , 5, 2, 7]);  
// Use the contains() function to check the elements
// exists in sequence or not var_dump ( $seq -> contains ( ` G` , `e` )); var_dump ( $seq -> contains ( ` k` , `e` , 7)); var_dump ( $seq -> contains ( ` p` , `1` )); var_dump ( $seq -> contains (7, 1)); var_dump ( $seq -> contains ( ` 5` , five));  
?>
Output:
bool (true) bool (true) bool (false) bool (false) bool (false)
Link: http://php.net/manual/en/ds-sequence.contains.php
Get Solution for free from DataCamp guru