2009-08-15 14:39:48 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- $Revision$ -->
|
|
|
|
|
|
|
|
<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>Invokes function args</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>
|
|
|
|
Invokes args.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
&warn.undocumented.func;
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>args</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2010-10-20 02:48:22 +00:00
|
|
|
The passed arguments to the function as an array, much like
|
|
|
|
<function>call_user_func_array</function> works.
|
2009-08-15 14:39:48 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
2010-10-20 02:48:22 +00:00
|
|
|
Returns the result of the invoked function
|
2009-08-15 14:39:48 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2010-10-20 02:48:22 +00:00
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><methodname>ReflectionFunction::invokeArgs</methodname> example</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
function title($title, $name)
|
|
|
|
{
|
2010-10-25 19:41:39 +00:00
|
|
|
return sprintf("%s. %s\r\n", $title, $name);
|
2010-10-20 02:48:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$function = new ReflectionFunction('title');
|
|
|
|
|
2010-10-25 19:41:39 +00:00
|
|
|
echo $function->invokeArgs(array('Dr', 'Phil'));
|
2010-10-20 02:48:22 +00:00
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
&example.outputs;
|
|
|
|
<screen>
|
|
|
|
<![CDATA[
|
|
|
|
Dr. Phil
|
|
|
|
]]>
|
|
|
|
</screen>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><methodname>ReflectionFunction::invokeArgs</methodname> with references example</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2010-10-25 19:41:39 +00:00
|
|
|
function get_false_conditions(array $conditions, array &$false_conditions)
|
2010-10-20 02:48:22 +00:00
|
|
|
{
|
2010-10-25 19:41:39 +00:00
|
|
|
foreach ($conditions as $condition) {
|
|
|
|
if (!$condition) {
|
|
|
|
$false_conditions[] = $condition;
|
|
|
|
}
|
|
|
|
}
|
2010-10-20 02:48:22 +00:00
|
|
|
}
|
|
|
|
|
2010-10-25 19:41:39 +00:00
|
|
|
$function_ref = new ReflectionFunction('get_false_conditions');
|
2010-10-20 02:48:22 +00:00
|
|
|
|
2010-10-25 19:41:39 +00:00
|
|
|
$conditions = array(true, false, -1, 0, 1);
|
|
|
|
$false_conditions = array();
|
2010-10-20 02:48:22 +00:00
|
|
|
|
2010-10-25 19:41:39 +00:00
|
|
|
$function_ref->invokeArgs(array($conditions, &$false_conditions));
|
2010-10-20 02:48:22 +00:00
|
|
|
|
|
|
|
var_dump($false_conditions);
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
&example.outputs;
|
|
|
|
<screen>
|
|
|
|
<![CDATA[
|
|
|
|
array(2) {
|
|
|
|
[0]=>
|
|
|
|
bool(false)
|
|
|
|
[1]=>
|
|
|
|
int(0)
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</screen>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="notes">
|
|
|
|
&reftitle.notes;
|
|
|
|
<note>
|
|
|
|
<para>
|
2010-10-25 19:38:17 +00:00
|
|
|
If the function has arguments that need to be references, then they must be
|
2010-10-20 02:48:22 +00:00
|
|
|
references in the passed argument list.
|
|
|
|
</para>
|
|
|
|
</note>
|
|
|
|
</refsect1>
|
|
|
|
|
2009-08-15 14:39:48 +00:00
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<para>
|
|
|
|
<simplelist>
|
|
|
|
<member><methodname>ReflectionFunction::invoke</methodname></member>
|
|
|
|
<member><methodname>ReflectionFunctionAbstract::getNumberOfParameters</methodname></member>
|
|
|
|
<member><link linkend="language.oop5.magic.invoke">__invoke</link></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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2009-08-15 14:39:48 +00:00
|
|
|
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
|
|
|
|
-->
|