PHP SET default argument as a static variable

you can set the default value of an argument in a class function as a static variable thanks for the help in Advance!

class UserControl { public static $CurrentUID; public static function isUserExist($CurrentUID = UserControl::$CurrentUID){ .... } } 
+5
source share
1 answer

You can make a workaround in this case:

 public static function isUserExist($CurrentUID = false) { if(!$CurrentUID) $CurrentUID = UserControl::$CurrentUID; .... } 
+5
source

Source: https://habr.com/ru/post/1207884/


All Articles