1
0
mirror of https://github.com/php/doc-es.git synced 2026-03-24 15:32:36 +01:00
Files
archived-doc-es/reference/reflection/reflectionfunction/invokeargs.xml
Andrés García 4776269390 updated to the most recent version.
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@322164 c90b9560-bf6c-de11-be94-00142212c4b1
2012-01-13 02:27:37 +00:00

159 lines
3.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: fcddfb2551140fba9a14a4c44dc9fa60004440c8 Maintainer: andresdzphp Status: ready -->
<!-- Reviewed: no Maintainer: andresdzphp -->
<refentry xml:id="reflectionfunction.invokeargs" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ReflectionFunction::invokeArgs</refname>
<refpurpose>Invoca a la función con argumentos</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>mixed</type><methodname>ReflectionFunction::invokeArgs</methodname>
<methodparam><type>array</type><parameter>args</parameter></methodparam>
</methodsynopsis>
<para>
Invoca la función y pasa sus argumentos como array.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>args</parameter></term>
<listitem>
<para>
Array con la lista de argumentos que se pasan a la función, similar a cómo
funciona <function>call_user_func_array</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Devuelve el resultado de la función invocada
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Ejemplo de <methodname>ReflectionFunction::invokeArgs</methodname></title>
<programlisting role="php">
<![CDATA[
<?php
function titulo($titulo, $nombre)
{
return sprintf("%s. %s\r\n", $titulo, $nombre);
}
$function = new ReflectionFunction('titulo');
echo $function->invokeArgs(array('Sr', 'Pedro'));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Dr. Pedro
]]>
</screen>
</example>
</para>
<para>
<example>
<title>Ejemplo de <methodname>ReflectionFunction::invokeArgs</methodname> con argumentos por referencia</title>
<programlisting role="php">
<![CDATA[
<?php
function obtener_condiciones_falsas(array $condiciones, array &$condiciones_falsas)
{
foreach ($condiciones as $condicion) {
if (!$condicion) {
$condiciones_falsas[] = $condicion;
}
}
}
$ref_a_funcion = new ReflectionFunction('obtener_condiciones_falsas');
$condiciones = array(true, false, -1, 0, 1);
$condiciones_falsas = array();
$ref_a_funcion->invokeArgs(array($condiciones, &$condiciones_falsas));
var_dump($condiciones_falsas);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(2) {
[0]=>
bool(false)
[1]=>
int(0)
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
&reflection.invoke.reference;
</para>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>ReflectionFunction::invoke</methodname></member>
<member><methodname>ReflectionFunctionAbstract::getNumberOfParameters</methodname></member>
<member><link linkend="object.invoke">__invoke()</link></member>
<member><function>call_user_func_array</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
-->