★ wanayoo — archive 1999 http://www.php.net/manual/fr/function.array-pad.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Tableaux
Quick Reference
English version of this pageGerman version of this pageJapanese version of this pageItalian version of this pageHungarian version of this page
Tableaux
* array
* array_count_values
* array_flip
* array_keys
* array_merge
* array_pad
* array_pop
* array_push
* array_reverse
* array_shift
* array_slice
* array_splice
* array_unshift
* array_values
* array_walk
* arsort
* asort
* compact
* count
* current
* each
* end
* extract
* in_array
* key
* krsort
* ksort
* list
* next
* pos
* prev
* range
* reset
* rsort
* shuffle
* sizeof
* sort
* uasort
* uksort
* usort
Manual: array_pad
View the source code for this pageSearch the site



Previous page
 array_merge
 Updated
Sun, 06 Aug 2000
array_pop 
Next page


array_pad

(PHP4 >= 4.0b4)

array_pad --  Complète un tableau jusqu'à la longueur spécifiée, avec une valeur.

Description

array array_pad (array input, int pad_size, mixed pad_value)

array_pad() retourne une copie du tableau input complété jusqu'à la taille de pad_size avec la valeur pad_value. si pad_size est positif alors le tableau est complété à droite, si il est négatif, il est complété à gauche. Si la valeurs absolue de pad_size est plus petite que la taille du tableau input alors le tableau n'est pas complété.

Exemple 1. Exemple avec array_pad()


$input = array (12, 10, 9);

$result = array_pad ($input, 5, 0);
// Le résultat est array (12, 10, 9, 0, 0)

$result = array_pad ($input, -7, -1);
// Le résultat est array (-1, -1, -1, -1, 12, 10, 9)

$result = array_pad ($input, 2, "noop");
// pas complété
      


User Contributed Notes: array_pad


cmoyer@chekinc.com
12-May-2000 08:09
It appears that this was also added in 4.0, or after
Version 3.0.14.



 About Notes


Previous page
 array_merge
 Updated
Sun, 06 Aug 2000
array_pop 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.