Bonjour,

je cherche à mettre en place un getter unique pour des attributs static mais j'y arrive pas.

Voilà ce que j'ai testé :

Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
class Test{
 
    private static $_attribut='plop';
 
    static function getAttribut($attribut){
         return self::$attribut;
    }
 
}
 
echo Test::getAttribut('$_attribut');

Comment faire pour retourner un attribut static privé dynamiquement (un seul getter pour n attributs) ?

Merci