1
0
mirror of https://github.com/php/doc-es.git synced 2026-03-29 01:42:12 +01:00
Files
archived-doc-es/reference/array/functions/array-slice.xml
Yago Ferrer 4a2bed8052 More files from: 'lboshell'
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@297985 c90b9560-bf6c-de11-be94-00142212c4b1
2010-04-14 10:23:56 +00:00

107 lines
3.4 KiB
XML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<!-- EN-Revision: n/a Maintainer: baoengb Status: ready -->
<!-- splitted from ./es/functions/array.xml, last change in rev 1.1 -->
<refentry xml:id="function.array-slice" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>array_slice</refname>
<refpurpose>Extrae una porción de la matriz</refpurpose>
</refnamediv>
<refsect1>
<title>Descripción</title>
<methodsynopsis>
<type>array</type><methodname>array_slice</methodname>
<methodparam><type>array</type><parameter>matriz</parameter></methodparam>
<methodparam><type>int</type><parameter>desplazamiento</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>tamaño</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>conserva_llaves</parameter></methodparam>
</methodsynopsis>
<para>
<function>array_slice</function> devuelve una secuencia de
elementos de la <parameter>matriz</parameter> especificada por
los parámetros <parameter>desplazamiento</parameter> y
<parameter>tamaño</parameter>.
</para>
<para>
Si el <parameter>desplazamiento</parameter> es no negativo, la secuencia
comenzará en dicha posición de la <parameter>matriz</parameter>. Si el
<parameter>desplazamiento</parameter> es negativo, la secuencia comenzará
en esa posición desde el final de la <parameter>matriz</parameter>.
</para>
<para>
Si se especifica el <parameter>tamaño</parameter> 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 <parameter>desplazamiento</parameter> hasta el final de la <parameter>matriz</parameter>.
</para>
<para>
Note que <function>array_slice</function> reasignará los índices
de la matriz por defecto. Desde PHP 5.0.2, usted puede cambiar este
comportamiento fijando el parámetro
<parameter>conserva_llaves</parameter> a &true;.
</para>
<para>
<example>
<title>Ejemplos de <function>array_slice</function></title>
<programlisting role="php">
<![CDATA[
<?php
$entrada = array("a", "b", "c", "d", "e");
$salida = array_slice($input, 2); // regresa "c", "d", and "e"
$salida = array_slice($input, -2, 1); // regresa "d"
$salida = array_slice($input, 0, 3); // regresa "a", "b", and "c"
// note la diferencias en las índices
print_r(array_slice($entrada, 2, -1));
print_r(array_slice($entrada, 2, -1, true));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[0] => c
[1] => d
)
Array
(
[2] => c
[3] => d
)
]]>
</screen>
</example>
</para>
<para>
Vea también: <function>array_splice</function>,
<function>unset</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->