Manuel PHP

get_called_class

(No version information available, might be only in CVS)

get_called_classthe "Late Static Binding" class name

Description

string get_called_class ( void )

Gets the name of the class the static method is called in.

Valeurs de retour

Returns the class name. Returns FALSE if called from outside a class.

Exemples

Exemple #1 Using get_called_class()

  1. <?php
  2.  
  3. class foo { 
  4.    static public function test() { 
  5.       var_dump(get_called_class()); 
  6.    }  
  7. }  
  8.  
  9. class bar extends foo {  
  10. }  
  11.  
  12. foo::test();  
  13. bar::test();  
  14.  
  15. ?> 

L'exemple ci-dessus va afficher :

string(3) "foo" string(3) "bar"


Remonter Remonter
L'éditeur javascript - CSS - Gentoo - Tutoriaux PHP - Tutoriels PHP - Bretagne - php - Moto - Kit graphique