I have the following simple code:
Code: Select all
<?php
class A {
public static function name()
{
echo get_called_class();
}
}
class B extends A {
}
A::name();
B::name();
?>
var $class_name = get_called_class();
$object = new $class_name;
I am using Dreamweaver CS6 and I get an syntax error on this: var $class_name = get_called_class();
What is more stranger that get_called_class() does not show up in the code completion but I checked that the function exist:
function_exists(get_called_class); returns true;
Why i cannot do this?: var $class_name = get_called_class(); // returns a string as i know
If I could, my code would have been simplified a lot.
Somebody could help on this?