mirror of
https://github.com/php/doc-it.git
synced 2026-03-27 09:02:09 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@91521 c90b9560-bf6c-de11-be94-00142212c4b1
94 lines
2.9 KiB
XML
94 lines
2.9 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- splitted from ./it/functions/classobj.xml, last change in rev 1.3 -->
|
|
<!-- last change to 'call-user-method' in en/ tree in rev 1.4 -->
|
|
<!-- EN-Revision: 1.4 Maintainer: darvina Status: ready -->
|
|
<!-- OLD-Revision: 1.38/EN.1.4 -->
|
|
<refentry id="function.call-user-method">
|
|
<refnamediv>
|
|
<refname>call_user_method</refname>
|
|
<refpurpose>
|
|
Chiama un metodo dell'oggetto indicato [deprecated]
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descrizione</title>
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>call_user_method</methodname>
|
|
<methodparam><type>string</type><parameter>nome_metodo</parameter></methodparam>
|
|
<methodparam><type>object</type><parameter>oggetto</parameter></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>parametro</parameter></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<warning>
|
|
<para>
|
|
A partire dalla versione 4.1.0 l'uso della funzione <function>call_user_method</function>
|
|
è sconsigliato; in sostituzione utilizzare la serie <function>call_user_func</function>
|
|
con la sintassi <literal>array(&$obj, "method_name")</literal>.
|
|
</para>
|
|
</warning>
|
|
<para>
|
|
Richiama il metodo indicato da <parameter>nome_metodo</parameter>
|
|
dell'oggetto <parameter>oggetto</parameter>. Di seguito si fornisce
|
|
un esempio di utilizzo. Qui si definisce una classe, si istanzia un
|
|
oggetto, e si utilizza <function>call_user_method</function> per
|
|
richiamare il metodo <varname>stampa_info</varname>
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
class Stato {
|
|
var $NOME;
|
|
var $TLD;
|
|
|
|
function Stato($nome, $tld) {
|
|
$this->NOME = $nome;
|
|
$this->TLD = $tld;
|
|
}
|
|
|
|
function stampa_info($prestr="") {
|
|
echo $prestr."Stato: ".$this->NOME."\n";
|
|
echo $prestr."Dominio di primo livello: ".$this->TLD."\n";
|
|
}
|
|
}
|
|
|
|
$paese = new Stato("Peru","pe");
|
|
|
|
echo "* Richiamo il metodo direttamente\n";
|
|
$paese->stampa_info();
|
|
|
|
echo "\n* utilizzo dello stesso metodo in modo indiretto\n";
|
|
call_user_method("stampa_info", $paese, "\t");
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
<simpara>
|
|
Vedere anche <function>call_user_func_array</function>,
|
|
<function>call_user_func</function>,
|
|
<function>call_user_method_array</function>.
|
|
</simpara>
|
|
</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:"../../../../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
|
|
-->
|