Change language

PHP Ds / Set function contains ()

Syntax:
bool public DsSet::contains ($values)
Parameters: This function accepts one or more values, which should check if the value is in the set or not.Returned value:if the value exists in the set, then it returns True, otherwise it returns False.The following programs illustrate the Ds / Set::contains()function in PHP:Program 1:  
// Declaring a new set $set = new DsSet ([ ’G’ , ’e’ , ’e’ , ’ k’ , ’s’ , 5, 2, 7]);  
// Use the contains() function to check the elements
// exists in the set or not var_dump ( $set -> contains ( ’ G’ )) ; var_dump ( $set -> contains ( ’ k’ ) ); var_dump ( $set -> contains ( ’ p’ ) ); var_dump ( $set -> contains (7)); var_dump ( $set -> contains ( ’ 5’ ) );  
?>
Exit:
bool (true ) bool (true) bool (false) bool (true) bool (false)
Program 2:  
// Declaring a new set $set = new DsSet ([ ’G’ , ’ e’ , ’e’ , ’k’ , ’ s’ , 5 , 2, 7]);  
// Use the contains() function to check the elements
// exists in the set or not var_dump ( $set -> contains ( ’ G’ , ’e’ )); var_dump ( $set -> contains ( ’ k’ , ’e’ , 7)); var_dump ( $set -> contains ( ’ p’ , ’1’ )); var_dump ( $set -> contains (7, 1)); var_dump ( $set -> contains ( ’ 5’ , five));  
?>
Exit:
bool (true ) bool (true) bool (false) bool (false) bool (false)
Link: http://php.net/manual/en/ds-set.contains.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method