<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.funchand.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.func-get-args.php',
    1 => 'func_get_args',
    2 => 'Returns an array comprising a function\'s argument list',
  ),
  'up' => 
  array (
    0 => 'ref.funchand.php',
    1 => 'Function handling Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.func-get-arg.php',
    1 => 'func_get_arg',
  ),
  'next' => 
  array (
    0 => 'function.func-num-args.php',
    1 => 'func_num_args',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/funchand/functions/func-get-args.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.func-get-args" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">func_get_args</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">func_get_args</span> &mdash; <span class="dc-title">Returns an array comprising a function&#039;s argument list</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.func-get-args-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>func_get_args</strong></span>(): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="para rdfs-comment">
   Gets an array of the function&#039;s argument list.
  </p>
  <p class="para">
   This function may be used in conjunction with 
   <span class="function"><a href="function.func-get-arg.php" class="function">func_get_arg()</a></span> and <span class="function"><a href="function.func-num-args.php" class="function">func_num_args()</a></span>
   to allow user-defined functions to accept variable-length argument lists.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.func-get-args-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">Questa funzione non contiene parametri.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.func-get-args-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Returns an array in which each element is a copy of the corresponding
   member of the current user-defined function&#039;s argument list. 
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.func-get-args-errors">
  <h3 class="title">Errori/Eccezioni</h3>
  <p class="para">
   Generates a warning if called from outside of a user-defined function.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.func-get-args-examples">
  <h3 class="title">Esempi</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="function"><strong>func_get_args()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">foo</span><span style="color: #007700">()<br />{<br />    </span><span style="color: #0000BB">$numargs </span><span style="color: #007700">= </span><span style="color: #0000BB">func_num_args</span><span style="color: #007700">();<br />    echo </span><span style="color: #DD0000">"Number of arguments: </span><span style="color: #0000BB">$numargs</span><span style="color: #DD0000"> \n"</span><span style="color: #007700">;<br />    if (</span><span style="color: #0000BB">$numargs </span><span style="color: #007700">&gt;= </span><span style="color: #0000BB">2</span><span style="color: #007700">) {<br />        echo </span><span style="color: #DD0000">"Second argument is: " </span><span style="color: #007700">. </span><span style="color: #0000BB">func_get_arg</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />    }<br />    </span><span style="color: #0000BB">$arg_list </span><span style="color: #007700">= </span><span style="color: #0000BB">func_get_args</span><span style="color: #007700">();<br />    for (</span><span style="color: #0000BB">$i </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">; </span><span style="color: #0000BB">$i </span><span style="color: #007700">&lt; </span><span style="color: #0000BB">$numargs</span><span style="color: #007700">; </span><span style="color: #0000BB">$i</span><span style="color: #007700">++) {<br />        echo </span><span style="color: #DD0000">"Argument </span><span style="color: #0000BB">$i</span><span style="color: #DD0000"> is: " </span><span style="color: #007700">. </span><span style="color: #0000BB">$arg_list</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">] . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />    }<br />}<br /><br /></span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Il precedente esempio visualizzerà:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Number of arguments: 3 
Second argument is: 2
Argument 0 is: 1
Argument 1 is: 2
Argument 2 is: 3</pre>
</div>
    </div>
   </div>
  </p>

  <p class="para">
   <div class="example" id="example-2">
    <p><strong>Example #2 <span class="function"><strong>func_get_args()</strong></span> example of byref and byval arguments</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">byVal</span><span style="color: #007700">(</span><span style="color: #0000BB">$arg</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">'As passed     : '</span><span style="color: #007700">, </span><span style="color: #0000BB">var_export</span><span style="color: #007700">(</span><span style="color: #0000BB">func_get_args</span><span style="color: #007700">()), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />    </span><span style="color: #0000BB">$arg </span><span style="color: #007700">= </span><span style="color: #DD0000">'baz'</span><span style="color: #007700">;<br />    echo </span><span style="color: #DD0000">'After change  : '</span><span style="color: #007700">, </span><span style="color: #0000BB">var_export</span><span style="color: #007700">(</span><span style="color: #0000BB">func_get_args</span><span style="color: #007700">()), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />}<br /><br />function </span><span style="color: #0000BB">byRef</span><span style="color: #007700">(&amp;</span><span style="color: #0000BB">$arg</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">'As passed     : '</span><span style="color: #007700">, </span><span style="color: #0000BB">var_export</span><span style="color: #007700">(</span><span style="color: #0000BB">func_get_args</span><span style="color: #007700">()), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />    </span><span style="color: #0000BB">$arg </span><span style="color: #007700">= </span><span style="color: #DD0000">'baz'</span><span style="color: #007700">;<br />    echo </span><span style="color: #DD0000">'After change  : '</span><span style="color: #007700">, </span><span style="color: #0000BB">var_export</span><span style="color: #007700">(</span><span style="color: #0000BB">func_get_args</span><span style="color: #007700">()), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">$arg </span><span style="color: #007700">= </span><span style="color: #DD0000">'bar'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">byVal</span><span style="color: #007700">(</span><span style="color: #0000BB">$arg</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">byRef</span><span style="color: #007700">(</span><span style="color: #0000BB">$arg</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Il precedente esempio visualizzerà:</p></div>
    <div class="example-contents screen"><br />
As passed     : array (<br />
  0 =&gt; &#039;bar&#039;,<br />
)<br />
After change  : array (<br />
  0 =&gt; &#039;baz&#039;,<br />
)<br />
As passed     : array (<br />
  0 =&gt; &#039;bar&#039;,<br />
)<br />
After change  : array (<br />
  0 =&gt; &#039;baz&#039;,<br />
)<br />
    </div>
   </div>
  </p>

 </div>


 <div class="refsect1 notes" id="refsect1-function.func-get-args-notes">
  <h3 class="title">Note</h3>
  <blockquote class="note"><p><strong class="note">Nota</strong>: <p class="para">As of PHP 8.0.0, the func_*() family of
functions is intended to be mostly transparent with regard to named arguments,
by treating the arguments as if they were all passed positionally,
and missing arguments are replaced with their defaults.
This function ignores the collection of unknown named variadic arguments.
Unknown named arguments which are collected can only be accessed through the variadic parameter.</p></p></blockquote>
  <blockquote class="note"><p><strong class="note">Nota</strong>: <p class="para">Se gli argomenti sono passati per riferimento,
ogni cambiamento degli argomenti si ripercuoterà sui valori restituiti da questa funzione.</p></p></blockquote>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <span class="simpara">
    This function returns a copy of the passed arguments only, and does not
    account for default (non-passed) arguments.
   </span>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.func-get-args-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><a href="functions.arguments.php#functions.variable-arg-list" class="link"><code class="literal">...</code> syntax</a></li>
    <li><span class="function"><a href="function.func-get-arg.php" class="function" rel="rdfs-seeAlso">func_get_arg()</a> - Return an item from the argument list</span></li>
    <li><span class="function"><a href="function.func-num-args.php" class="function" rel="rdfs-seeAlso">func_num_args()</a> - Returns the number of arguments passed to the function</span></li>
    <li><span class="methodname"><a href="reflectionfunctionabstract.getparameters.php" class="methodname" rel="rdfs-seeAlso">ReflectionFunctionAbstract::getParameters()</a> - Gets parameters</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>