Bonjour à tous,
Alors voila j'ai un petit problème de variable static.
Exemple :
<CODE>
class Test{
private static $test;
public static function getVariable(){
return self::$test;
}
public static function setVariable($id){
self::$test = $id;
}
public static methode1(){
// Traitement ... Utilise self::getVariable()
}
public static methode2(){
// Traitement....self::getVariable()
}
}
</CODE>
Dans une page j'initialise $test => Exemple Test::setVariable(2); Ca marche.
Ensuite je fait Test::methode1(); Ca marche
Et enfin le drame Test::methode2(); Ca marche pas $test semble réinitialisé.
Je ne comprend pas pourquoi il y a une ré initialisation de ma variable, si quelqu'un pourrait m'expliquer.
Par avance merci.
@ +++