private static $var = $_SESSION['test']; public static function testf() { .... self::$var = null; }
most likely, we delete the reference and assign the variable to null. There is in programming the concept of refactoring in simple words, this is when the application is developed in such a way that it allows to do what is necessary. If it does not allow you to do this, look more deeply, and make it so that it (the application) would permit and work. And you can work and even need to check the unit with the test after development, you start unit testing, if the application has passed the test, then all the rules, you can drink champagne, if not, then you are refactoring again ... etc. etc. In general, this way we get "beautiful code" with which it is pleasant to work.
$tmp, destroy$var, and then take a session value from$tmpand thenunset($tmp);more - Alexey Shimanskyunset(self::$var)you still need to doself:$var = null. Becauseunsetdestroy the variable. and you, as I understand it, you just need anullwas the value - Alexey Shimansky