downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

func_get_arg> <forward_static_call_array
Last updated: Fri, 14 Aug 2009

view this page in

forward_static_call

(PHP 5 >= 5.3.0)

forward_static_callAppelle une méthode statique

Description

mixed forward_static_call ( callback $function [, mixed $parameter [, mixed $... ]] )

Appelle une fonction ou une méthode utilisateur, nommée function , avec les arguments qui suivent. Cette fonction doit être appelée depuis une méthode, et ne peut pas être utilisée hors d'une classe.

Liste de paramètres

function

La fonction ou la méthode appelée. Ce paramètre peut être un tableau, avec le nom de la classe et de la méthode, ou une chaîne, avec le nom de la fonction.

parameter

Zéro ou plusieurs paramètres à passer à la fonction.

Valeurs de retour

Retourne le résultat de la fonction, ou bien FALSE en cas d'erreur.

Exemples

Exemple #1 Exemple avec forward_static_call()

<?php

class A
{
    const 
NAME 'A';
    public static function 
test() {
        
$args func_get_args();
        echo static::
NAME" ".join(','$args)." \n";
    }
}

class 
extends A
{
    const 
NAME 'B';

    public static function 
test() {
        echo 
self::NAME"\n";
        
forward_static_call(array('A''test'), 'encore''plus');
        
forward_static_call'test''encore''autres');
    }
}

B::test('foo');

function 
test() {
        
$args func_get_args();
        echo 
"C ".join(','$args)." \n";
    }

?>

L'exemple ci-dessus va afficher :

B
B encore,plus 
C encore,autres 

Voir aussi



add a note add a note User Contributed Notes
forward_static_call
There are no user contributed notes for this page.

func_get_arg> <forward_static_call_array
Last updated: Fri, 14 Aug 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites