:: Anbieterverzeichnis :: Globale Branchen
:: SELFPHP Forum ::
Fragen rund um die Themen PHP?
In ?ber
130.000 Beitr?gen finden Sie sicher die passende
Antwort! 
:: Newsletter ::
Abonnieren Sie hier den kostenlosen
SELFPHP Newsletter!
|
|
range  |
|
Befehl | Version | Beschreibung | Beispiel 1 | Ausgabe 1 | Beispiel 2 | Ausgabe 2 | Beispiel 3 | Ausgabe 3 | Beispiel 4 | Ausgabe 4 | Download |
SELFPHP ist Shopware Solution Partner
Shopware ist ein vielfach ausgezeichnetes Onlineshop-System der shopware AG, das auf PHP. Zend Framework und SQL basiert.
SELFPHP unterstützt Sie als Shopware Solution Partner bei der Konzeption, Programmierung und Realisierung Ihres Onlineshops und passt Shopware bei Bedarf an Ihre Unternehmensbedürfnisse an.
Weitere Informationen
Befehl
array range ( mixed $low, mixed $high [, number $step] ) |
Version
Beschreibung
Warning: include_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /var/www/html/_includeSELFPHP/funktionsreferenz.inc.php on line 405
Warning: include_once(http://geoserver.selfphp.com/million-dollar.php?remote_address=172.17.0.1): failed to open stream: no suitable wrapper could be found in /var/www/html/_includeSELFPHP/funktionsreferenz.inc.php on line 405
Warning: include_once(): Failed opening 'http://geoserver.selfphp.com/million-dollar.php?remote_address=172.17.0.1' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/_includeSELFPHP/funktionsreferenz.inc.php on line 405
Die Funktion range() erzeugt ein Array, das von dem Startwert low bis zum Endwert high reicht (Beispiel 1). Ist low größer als high, so wird in umgekehrter Reihenfolge das Array erzeugt (Beispiel 4).
In PHP 5.0.0 wurde der optionale Parameter step eingeführt, der auch schrittweise ein Array aufbaut (Beispiel 3).
Siehe auch:
• shuffle()
• foreach() |
Beispiel 1
<?PHP
$array = range ( 1, 10 );
foreach ( $array as $wert )
{
echo $wert . ', ';
}
?>
|
Ausgabe 1
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
Beispiel 2
<?PHP
foreach ( range ( a, r ) as $wert )
{
echo $wert . ', ';
}
?>
|
Ausgabe 2
a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r,
|
Beispiel 3
<?PHP
$array = range ( 1, 100, 10 );
foreach ( $array as $wert )
{
echo $wert . ', ';
}
?>
|
Ausgabe 3
10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
|
Beispiel 4
<?PHP
$array = range ( 8, 2 );
foreach ( $array as $wert )
{
echo $wert . ', ';
}
?>
|
Ausgabe 4
|
|
|
|
|


|