Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP SET default argument in function as static variable

is it possible to set the default value of an argument in a class function as static variable thanks for the help in Advance!

class UserControl {

    public static $CurrentUID;

    public static function isUserExist($CurrentUID = UserControl::$CurrentUID){

     ....

    }
}
like image 655
O_o lovesCandy Avatar asked Nov 28 '14 11:11

O_o lovesCandy


1 Answers

You can make a workaround in this case:

public static function isUserExist($CurrentUID = false)
{
   if(!$CurrentUID)
      $CurrentUID = UserControl::$CurrentUID;
   ....
}
like image 162
hlscalon Avatar answered Sep 28 '22 09:09

hlscalon