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

PHP Home Page

Manual Table of Contents
Up to Matrices
Quick Reference
English version of this pageGerman version of this pageJapanese version of this page
Italian version of this pageFrench version of this pageHungarian version of this page
Spanish version of this pageDutch version of this pageBrazilian Portuguese version of this page
Korean version of this pageCzech version of this page
Matrices
* 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
* rango
* reset
* rsort
* shuffle
* sizeof
* sort
* uasort
* uksort
* usort

  Thanks to:
 Chek.com
 easyDNS
 VA Linux Systems

  Related sites:
Apache
MySQL
PostgreSQL
Zend Tech.

  Community:
LinuxFund.org
OSDN
Manual: array_slice
View the source code for this pageSearch the site



Previous page
 array_shift
 Updated
Tue, 27 Feb 2001
array_splice 
Next page


array_slice

(PHP 4 )

array_slice -- Extrae una porción de la matriz

Descripción

array array_slice (array matriz, int desplazamiento [, int tamano])

array_slice() devuelve una secuencia de elementos de la matriz especificada por los parámetros desplazamiento y tamano.

Si el desplazamiento es positivo, la secuencia comenzará en dicha posición de la matriz. Si el desplazamiento es negativo, la secuencia comenzará en esa posición desde el final de la matriz.

Si se especifica el tamano y éste es positivo, la secuencia contendrá tantos elementos como se diga en él. Si fuese negativo, la secuencia se detendrá a tantos elementos del final de la matriz. Si se omite, la secuencia contendrá todos los elementos desde el desplazamiento hasta el final de la matriz.

Ejemplo 1. Ejemplo de array_slice() examples


$entrada = array ("a", "b", "c", "d", "e");

$salida = array_slice ($entrada, 2);      // devuelve "c", "d", y "e"
$salida = array_slice ($entrada, 2, -1);  // devuelve "c", "d"
$salida = array_slice ($entrada, -2, 1);  // devuelve "d"
$salida = array_slice ($entrada, 0, 3);   // devuelve "a", "b", y "c"
      

Vea también: array_splice().

Nota: Esta función fue añadida en el PHP 4.0.


 About Notes


Previous page
 array_shift
 Updated
Tue, 27 Feb 2001
array_splice 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
France
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.