mirror of
https://github.com/php/doc-es.git
synced 2026-03-26 08:22:08 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@324249 c90b9560-bf6c-de11-be94-00142212c4b1
153 lines
4.0 KiB
XML
153 lines
4.0 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 5faa7a6747bca628b3bdcc9f93aec5603b65581f Maintainer: seros Status: ready -->
|
|
<refentry xml:id="function.forward-static-call-array" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>forward_static_call_array</refname>
|
|
<refpurpose>Llamar a un método estático y pasar los argumentos como matriz</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>forward_static_call_array</methodname>
|
|
<methodparam><type>callable</type><parameter>function</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>parameters</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Llama a una función o método definido por el usuario, dado por el parámetro
|
|
<parameter>function</parameter>. Esta función debe ser llamada dentro del contexto de un método, no
|
|
se puede usar fuera de una clase.
|
|
Usa el <link linkend="language.oop5.late-static-bindings">Enlace estático
|
|
en tiempo de ejecución</link>.
|
|
Todos los argumentos del método a llamar se pasan como valores,
|
|
y como matriz, similar a <function>call_user_func_array</function>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>function</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La función o método a ser llamado. Este parámetro puede ser un &array;,
|
|
con el nombre de la clase y del método, o un &string;, con el nombre de una
|
|
función.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>parameter</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Un parámetro, reuniendo todos los parámetros del método en una matriz.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Observe que los parámetros para <function>forward_static_call_array</function> no
|
|
son pasados por referencia.
|
|
</para>
|
|
</note>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve el resultado de la función, o &false; en caso de error.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <function>forward_static_call_array</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
class A
|
|
{
|
|
const NOMBRE = 'A';
|
|
public static function prueba() {
|
|
$args = func_get_args();
|
|
echo static::NOMBRE, " ".join(',', $args)." \n";
|
|
}
|
|
}
|
|
|
|
class B extends A
|
|
{
|
|
const NOMBRE = 'B';
|
|
|
|
public static function prueba() {
|
|
echo self::NOMBRE, "\n";
|
|
forward_static_call_array(array('A', 'prueba'), array('más', 'args'));
|
|
forward_static_call_array( 'prueba', array('otro', 'args'));
|
|
}
|
|
}
|
|
|
|
B::prueba('foo');
|
|
|
|
function prueba() {
|
|
$args = func_get_args();
|
|
echo "C ".join(',', $args)." \n";
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
B
|
|
B más,args
|
|
C otro,args
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>forward_static_call</function></member>
|
|
<member><function>call_user_func</function></member>
|
|
<member><function>call_user_func_array</function></member>
|
|
<member><function>is_callable</function></member>
|
|
<member>&seealso.callback;</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
|
|
-->
|