i've got a bit of a problem with getting a singleton to work in php 5.3
What i want to achieve is that i'll be able to include one php file with a class, that lets me translate webpages by a dictionary over a global singleton.
Usage example:
<?php
include_once "CLocale.php";
?>
//...
<head>
<title><?php CLocale::Instance()->getText("StrMemberArea")?></title>
My class looks like the following at the moment:
class CLocale
{
private function __clone()
{
}
public static function Instance()
{
if (static::$_instance === NULL)
{
static::$_instance = new static();
}
return static::$_instance;
}
private function __construct()
{
}
public function getText($str)
{
return "Test";
}
}
So, the problem is, i don't get any output of "Test" when using the class like shown above, also, i don't get any error. PHP Storm isn't really showing me any errors. Perhaps one of you guys is able to spot a problem somewhere.
Thanks in advance, calav3ra
PS: I don't mind how the singleton is implemented
echocall.