I have code that follows this structure:
class someClass
{
private static $pay = 0;
//something like this...
public static function run()
{
if ($_SESSION['title']== "whatever" and $_SESSION['rank'] == "1")
{
self::$pay = 50000;
}
}
public static function benefits()
{
self::$pay = 50000 * 1.30;
benefits = self:$pay;
echo benefits;
}
}
Then I try calling benefits like this…
someClass::benefits();
But it’s always set to zero. It never changes when the condition from the if statement is met.
Is there something I am doing here that is obviously wrong? I am not getting any errors.
Thank you for your help.
Try the below code: