mirror of
https://github.com/php/doc-es.git
synced 2026-04-24 15:48:13 +02:00
e5a7dadb5d
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@334674 c90b9560-bf6c-de11-be94-00142212c4b1
186 lines
4.2 KiB
XML
186 lines
4.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 84630c830d5faffd83898d7e6fb41198b912a685 Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="function.func-num-args" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>func_num_args</refname>
|
|
<refpurpose>Devuelve el número de argumentos pasados a la función</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>func_num_args</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
Obtiene el número de argumentos pasados a la función.
|
|
</para>
|
|
<para>
|
|
Esta función se puede usar junto con
|
|
<function>func_get_arg</function> y <function>func_get_args</function> para permitir
|
|
a las funciones definidas por el usuario aceptar listas de argumentos de longitud variable.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve el número de argumentos pasados a la función actual definida por el
|
|
usuario.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>5.3.0</entry>
|
|
<entry>
|
|
Esta función ahora se puede usar en listas de parámetros.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>5.3.0</entry>
|
|
<entry>
|
|
Si esta función es llamada desde el ámbito último de un fichero
|
|
que ha sido incluido mediante una llamada a <function>include</function>
|
|
o <function>require</function> desde dentro de una función en el
|
|
fichero de llamada, ahora genera una advertencia y devuelve -1.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Genera una advertencia si se llama desde fuera de una función definida por el usuario.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <function>func_num_args</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
function foo()
|
|
{
|
|
$númargs = func_num_args();
|
|
echo "Número de argumentos: $númargs\n";
|
|
}
|
|
|
|
foo(1, 2, 3);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Número de argumentos: 3
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <function>func_num_args</function> antes y después de
|
|
PHP 5.3</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
prueba.php
|
|
<?php
|
|
function foo() {
|
|
include './fna.php';
|
|
}
|
|
|
|
foo('Primer argumento', 'Segundo argumento');
|
|
?>
|
|
|
|
fna.php
|
|
<?php
|
|
|
|
$núm_args = func_num_args();
|
|
var_export($núm_args);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
Salida antes de PHP 5.3:
|
|
</para>
|
|
<screen>
|
|
<![CDATA[
|
|
2
|
|
]]>
|
|
</screen>
|
|
<para>
|
|
La salida en PHP 5.3 y posterior será algo similar a:
|
|
</para>
|
|
<screen>
|
|
<![CDATA[
|
|
Warning: func_num_args(): Called from the global scope - no function
|
|
context in /home/torben/Desktop/code/ml/fna.inc on line 3
|
|
-1
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
¬e.funcnoparam;
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><link linkend="functions.variable-arg-list.new">La sintaxis <literal>...</literal> en PHP 5.6+</link></member>
|
|
<member><function>func_get_arg</function></member>
|
|
<member><function>func_get_args</function></member>
|
|
<member><methodname>ReflectionFunctionAbstract::getNumberOfParameters</methodname></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
|
|
-->
|