Set
PHP Manual

Ds\Set::contains

(PECL ds >= 1.0.0)

Ds\Set::containsDetermines if the set contains all values.

Descrierea

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

Determines if the set contains all values.

Notă:

Values of type object are supported. If an object implements Ds\Hashable, equality will be determined by the object's equals function. If an object does not implement Ds\Hashable, objects must be references to the same instance to be considered equal.

Precauţie

All comparisons are strict (type and value).

Parametri

values

Values to check.

Valorile întoarse

FALSE if any of the provided values are not in the set, TRUE otherwise.

Exemple

Example #1 Ds\Set::contains() example

<?php
$set 
= new \Ds\Set([123]);

var_dump($set->contains(1));                // true
var_dump($set->contains(12));             // true
var_dump($set->contains(...[12]));        // true

var_dump($set->contains("1"));              // false
var_dump($set->contains(...[1234]));  // false

var_dump($set->contains(...[]));            // true
?>

Exemplul de mai sus va afișa ceva similar cu:

bool(true)
bool(true)
bool(true)
bool(false)
bool(false)
bool(true)

Set
PHP Manual