Gold Vision Communications / USA
 GOLDVISION.COM
Serving the Multimedia Community since 1989.
English Site | German Site 

 Web Hosting

 Virtual Dedicated Servers

 Chequeo de dominio

 Haga su pedido

 Estado del pedido

 Support

 Contáctenos

 Download

 Network

 Network Status

 Webdesign / Templates

 Efectuar pago

 Terms & Conditions

 Imprimir

 Notas Legales

 Declaración de Privacidad
  PHP / count
count

count

(PHP 3, PHP 4 )

count -- Zählt die Elemente einer Variable

Beschreibung

int count ( mixed var)

Liefert die Anzahl von Elementen in var, welche typischerweise ein Array ist (da alles andere ein Element enthält).

Ist var kein Array, wird 1 zurückgegeben (Ausnahme: count(NULL) ist gleich 0).

Warnung

count() kann 0 zurückgeben wenn die Variable nicht gesetzt ist, aber sie könnte ebenfalls 0 zurückgeben, wenn eine Variable als leeres Array initialisiert wurde. Verwenden Sie isset() um zu testen, ob eine Variable gesetzt ist.

In der Sektion Arrays finden Sie eine detaillierte Erklärung, wie Arrays in PHP implementiert sind und wie sie benutzt werden.

Beispiel 1. count()

$a[0] = 1;
$a[1] = 3;
$a[2] = 5;
$result = count ($a);
//$result == 3

$b[0] = 7;
$b[5] = 9;
$b[10] = 11;
$result = count ($b);
// $result == 3;

Anmerkung: Die Funktion sizeof() ist ein Alias für count().

Siehe auch is_array(), isset() und strlen().


© 1998-2007 Gold Vision Communications All Rights Reserved.