Possible Duplicate:
Getting static property from a class with dynamic class name in PHP
Take a quick look before you are going to reading my question:
In PHP we can:
Code:
<?php
class Foo
{
const TOUCH_ME = 1;
public function __construct()
{
}
}
$class = 'Foo';
$object = new $class();
$type = $object instanceof Foo;
echo $type;//Expect to 1
?>
Output:
1
And my question is, how can I do:
Code:
<?php
class Foo
{
const TOUCH_ME = 1;
public function __construct()
{
}
}
$class = 'Foo';
$var = $class::TOUCH_ME;
?>
Output:
An error
So, how can I do that? Or am I stupid?