mirror of
https://github.com/php/doc-es.git
synced 2026-03-24 15:32:36 +01:00
139 lines
3.7 KiB
XML
139 lines
3.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 2e60c5134e7a847c99f81eb3f7ecee1f5efeeace Maintainer: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<!-- CREDITS: DavidA. -->
|
|
|
|
<refentry xml:id="function.next" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>next</refname>
|
|
<refpurpose>Avance el puntero interno de un array</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>next</methodname>
|
|
<methodparam><type class="union"><type>array</type><type>object</type></type><parameter role="reference">array</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>next</function> se comporta como
|
|
<function>current</function>, con una diferencia. Avance
|
|
el puntero interno del array un elemento, antes de devolver
|
|
el valor del elemento. Esto significa que devuelve el próximo
|
|
valor del array y avanza el puntero interno un elemento.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>array</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El array a tratar.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve el próximo valor del array siguiendo el puntero interno,
|
|
o &false; si no hay más elementos.
|
|
</para>
|
|
&return.falseproblem;
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&standard.changelog.calling-on-objects;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo con <function>next</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$transport = array('foot', 'bike', 'car', 'plane');
|
|
echo $mode = current($transport), PHP_EOL; // $mode = 'foot';
|
|
echo $mode = next($transport), PHP_EOL; // $mode = 'bike';
|
|
echo $mode = next($transport), PHP_EOL; // $mode = 'car';
|
|
echo $mode = prev($transport), PHP_EOL; // $mode = 'bike';
|
|
echo $mode = end($transport), PHP_EOL; // $mode = 'plane';
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<simpara>
|
|
No es posible distinguir el final de un array
|
|
del elemento <type>bool</type> &false;.
|
|
Para recorrer correctamente un array que
|
|
puede contener el elemento &false;, véase la función
|
|
<link linkend="control-structures.foreach"><literal>foreach</literal></link>.
|
|
</simpara>
|
|
<simpara>
|
|
Para continuar utilizando <function>next</function> y detectar correctamente
|
|
si se ha alcanzado el final del array, la <function>key</function> es &null;.
|
|
</simpara>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>current</function></member>
|
|
<member><function>end</function></member>
|
|
<member><function>prev</function></member>
|
|
<member><function>reset</function></member>
|
|
<member><function>each</function></member>
|
|
</simplelist>
|
|
</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:"~/.phpdoc/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
|
|
-->
|