mirror of
https://github.com/php/doc-es.git
synced 2026-03-25 07:52:21 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@172353 c90b9560-bf6c-de11-be94-00142212c4b1
107 lines
3.5 KiB
XML
107 lines
3.5 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.4 $ -->
|
|
<!-- EN-Revision: 1.10 Maintainer: baoengb Status: ready -->
|
|
<!-- splitted from ./es/functions/array.xml, last change in rev 1.1 -->
|
|
<refentry id="function.array-slice">
|
|
<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 positivo, 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
|
|
-->
|