PHP - Ds \ Collection :: isEmpty ()
La fonction Ds \ Collection :: isEmpty () peut retourner si la collection est vide.
Syntaxe
abstract public bool Ds\Collection::isEmpty( void )
La fonction Ds \ Collection :: isEmpty () n'a aucun paramètre. Cette fonction peut retourner true si la collection est vide, ou false dans le cas contraire.
Exemple 1
<?php
$collection = new \Ds\Vector([10, 15, 20, 25, 30, 35]);
$res = $collection->isEmpty();
var_dump($res);
$collection = new \Ds\Vector();
$res = $collection->isEmpty();
var_dump($res);
?>
Exemple-2
<?php
$collection = new \Ds\Vector();
var_dump($collection->isEmpty());
$collection = new \Ds\Vector([1, 3, 5, 2, 6]);
var_dump($collection->isEmpty());
?>