mirror of
https://github.com/php/doc-es.git
synced 2026-03-24 15:32:36 +01:00
162 lines
4.5 KiB
XML
162 lines
4.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: cec5275f23d2db648df30a5702b378044431be97 Maintainer: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
<refentry xml:id="function.array-walk-recursive" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>array_walk_recursive</refname>
|
|
<refpurpose>Aplica una función de retrollamada de manera recursiva a cada miembro de un array</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>true</type><methodname>array_walk_recursive</methodname>
|
|
<methodparam><type class="union"><type>array</type><type>object</type></type><parameter role="reference">array</parameter></methodparam>
|
|
<methodparam><type>callable</type><parameter>callback</parameter></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>arg</parameter><initializer>&null;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Aplica la función de usuario <parameter>callback</parameter>
|
|
a cada elemento del array <parameter>array</parameter>. Esta
|
|
función se reproducirá en todas las profundidades del array.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>array</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El array de entrada.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>callback</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Típicamente, <parameter>callback</parameter> toma 2 argumentos.
|
|
El argumento <parameter>array</parameter>, representando el valor, es
|
|
el primero, el índice/clave, el segundo.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Si <parameter>callback</parameter> debe ser ejecutado con los valores
|
|
actuales del array, especifique el primer argumento de
|
|
<parameter>callback</parameter> por
|
|
<link linkend="language.references">referencia</link>.
|
|
Entonces, cualquier cambio efectuado en los elementos de este array será
|
|
también efectuado en el array original.
|
|
</para>
|
|
</note>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>arg</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Si el argumento opcional <parameter>arg</parameter> es proporcionado,
|
|
será pasado como tercer argumento a la función de retrollamada
|
|
<parameter>callback</parameter>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.true.always;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&return.type.true;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo con <function>array_walk_recursive</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$sweet = array('a' => 'apple', 'b' => 'banana');
|
|
$fruits = array('sweet' => $sweet, 'sour' => 'lemon');
|
|
|
|
function test_print($item, $key)
|
|
{
|
|
echo "La clave $key contiene el elemento $item\n";
|
|
}
|
|
|
|
array_walk_recursive($fruits, 'test_print');
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen role="php">
|
|
<![CDATA[
|
|
La clave a contiene el elemento apple
|
|
La clave b contiene el elemento banana
|
|
La clave sour contiene el elemento lemon
|
|
]]>
|
|
</screen>
|
|
<para>
|
|
Se habrá notado que la clave '<literal>sweet</literal>'
|
|
nunca es mostrada. Cualquier clave que esté asociada
|
|
a un &array; no es pasada a la función de retrollamada.
|
|
</para>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>array_walk</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
|
|
-->
|