Home :: International :: Manuals :: Howto :: FAQ :: Man Pages :: Email Login

 
 

 

array_fill

(PHP 4 >= 4.2.0, PHP 5)

array_fill -- Füllt ein Array mit Werten

Beschreibung

array array_fill ( int start_index, int num, mixed value)

array_fill() füllt ein Array mit num Einträgen des Wertes des value Parameters. Die Indizes des Arrays beginnen mit dem start_index Parameter. Beachten Sie, dass num eine Zahl größer als Null sein muss, ansonsten gibt PHP eine Warnung aus.

Beispiel 1. array_fill()

<?php
$a
= array_fill(5, 6, 'Banane');
print_r($a);
?>

Nun ist $a:

Array
(
    [5]  => Banane
    [6]  => Banane
    [7]  => Banane
    [8]  => Banane
    [9]  => Banane
    [10] => Banane
)

 
 
 
 
Google
  Web Linuxinfor   
 

Home :: Copyright :: Privacy :: Credits :: Get a free Linuxinfor Email Account

Document on this page is part of "PHP Handbuch". See Index Page for more info about Authorship and Copyright.

1999-2009 Linuxinfor.com. No rights reserved.