Funkcja PHP Ds/Set count()

| | | | | | | | |
Składnia:
int public DsSet::count()
Parametry:ta funkcja nie przyjmuje parametrów.Powrót wartość:ta funkcja zwraca liczbę wartości ‚Ęã‚Ęã obecnych w instancji Set. Poniższe programy ilustrują funkcję Ds / Set::count() :Program 1:
// Zadeklaruj nowy zestaw$set = nowy DsSet ([10, 15, 21]);
// Pokaż element zestawuvar_dump ( $set );
// Wyświetl liczbę elementów
// obecne w zestawieecho "Liczba to:" ; print_r ( $set -> count ());
?> Wyjście:
obiekt (DsSet ) # 1 (3) {[0] = > int (10) [1] = > int (15) [2] = > int (21)} Liczba to: 3
Program 2:
// Zadeklaruj nowy zestaw$set = nowy DsSet ( [ "Maniacy" , "for" , "Keegs" ]);
// Pokaż element zestawuvar_dump ( $set );
// Wyświetl liczbę elementów
// obecne w zestawieecho "Liczba to:" ; print_r ( $set -> count ());
?>
Wyjście:
object (DsSet ) # 1 (3) {[0] = > string (5) "Geeks" [1] = > string (3) "for " [2] = > string (5) "Keegs"} Liczba to: 3
Link: http://php.net/manual/en/ds-set. count.php