My brain is running out of power and with it my skill to search (I didn't find an 100% answer to what I'm looking for). That being said, I have a class inside which is an empty static variable $title which I'd need to define inside __construct, but it can't seem to get it via global. Let's just show some code, shall we?
$arg = array( my data is here );
class Article
{
static $title;
public function __construct()
{
global $arg;
self::$title = $arg['title'];
}
public static function title()
{
return self::$title;
}
}
My end goal would be to simply do
echo Article::title();
to get the title of the article. But as I previously mentioned, I have no such luck. All help is appreciated.
globalrather than just passing the title to the constructor?