PHP Doku:: Constructs a new fixed array - splfixedarray.construct.html

Verlauf / Chronik / History: (5) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige GrunderweiterungenStandard PHP Library (SPL)DatenstrukturenThe SplFixedArray classSplFixedArray::__construct

Ein Service von Reinhard Neidl - Webprogrammierung.

The SplFixedArray class

<<The SplFixedArray class

SplFixedArray::count>>

SplFixedArray::__construct

(PHP 5 >= 5.3.0)

SplFixedArray::__constructConstructs a new fixed array

Beschreibung

public SplFixedArray::__construct() ([ int $size = 0 ] )

Constructs a new empty fixed array.

Parameter-Liste

size

The size of the fixed array.

Rückgabewerte

Es wird kein Wert zurückgegeben.

Beispiele

Beispiel #1 SplFixedArray::__construct() example

<?php
$array 
= new SplFixedArray(5);

$array[1] = 2;
$array[4] = "foo";

foreach(
$array as $v) {
  
var_dump($v);
}
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

NULL
int(2)
NULL
NULL
string(3) "foo"


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)