★ wanayoo — archive 1999 http://www.php.net/manual/it/function.call-user-method.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Variabili
Quick Reference
English version of this pageGerman version of this pageJapanese version of this pageHungarian version of this page
Variabili
* call_user_func
* call_user_method
* doubleval
* empty
* gettype
* intval
* is_array
* is_bool
* is_double
* is_float
* is_int
* is_integer
* is_long
* is_numeric
* is_object
* is_real
* is_resource
* is_string
* isset
* print_r
* settype
* strval
* unset
* var_dump
Manual: call_user_method
View the source code for this pageSearch the site



Previous page
 call_user_func
 Updated
Sun, 06 Aug 2000
doubleval 
Next page


call_user_method

(PHP3 >= 3.0.3, PHP4 )

call_user_method --  Richiama un Metodo definito dall'utente in un determinato Oggetto

Descrizione

mixed call_user_method (string nome_del_metodo, object nome_oggetto [, mixed parametro [, mixed ...]])

Richiama il Metodo individuato da nome_del_metodo in un determinato oggetto nome_oggetto definito dall'utente. Si veda il seguente esempio, dove viene definito un Oggetto, istanziata una Classe e utilizzato: call_user_method() per richiamare indirettamente il suo metodo stampa_info.


<?php
class Paese {
	var $NOME;
	var $TLD;
	
	function Paese($nome, $tld) {
  		$this->NOME = $nome;
		$this->TLD = $tld;
	}

	function stampa_info($prestr="") {
		echo $prestr."Paese: ".$this->NOME."\n";
		echo $prestr."Dominio di Primo Livello (TLD): ".$this->TLD."\n";
	}
}

$un_paese = new Paese("Peru","pe");

echo "* Chiamiamo il Metodo dello specifico Oggetto in maniera diretta\n";
$un_paese->stampa_info();

echo "\n* Chiamiamo lo stesso Metodo in maniera indiretta\n";
call_user_method ("stampa_info", $un_paese, "\t");
?>
      


User Contributed Notes: call_user_method


carmelo@akooe.com
12-Aug-2000 07:03
Ok, this function could be usefull IF you could pass argument as an array for instance, this way you can call dynamicaly function with a variable number of arguments without haing to use an eval.
As it it conceived just now, You might use $object->$method( [args] ) and you got he same thing.



 About Notes


Previous page
 call_user_func
 Updated
Sun, 06 Aug 2000
doubleval 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.