isset()中的未定义变量

Can be closed, lost the overview in my project and worked in a file, that has the same name and method. So no changes were made. It works now. Sorry for wasting your time. My mistake.

I have a static factory method in which I'm trying to get the classname of the parameter.

static function factory($row)
{
  if (is_null($classname)) {
    $classname=get_called_class();
  }

Error Output:

[Tue Sep 23 18:35:24.078345 2014] [:error] [pid 9971] [client 127.0.0.1:45702] PHP Notice: Undefined variable: classname in /var/www/dev/lib/class.base.php on line 9, referer:

> http://localhost/dev/app.php?action=do

When I try to set the $classname = null; before check it, there is also a undefined variable error. Same thing with isset($classname). What have i done wrong?

Here is another example, thhat doesn't work for me:

 class definetest{
 static function factory()
    {
      if (is_null($classname)) {
        $classname=get_called_class();
      }
      return $classname;
    }

}

$x = new definetest();

echo $x::factory();

It returns the classname, but I have an error in my apache log

static function factory($row)
{
  if (isset($classname)) {
    $classname = get_called_class();
  }
}

If you use isset() before call to variable. It is not possible to show notice undefined variable.

http://php.net/manual/en/function.isset.php isset — Determine if a variable is set and is not NULL