Hi,
Bart de Boer wrote:
$class = 'Child';
$obj = new $class(); // This works.
echo $class::$var; // This doesn't. Should map to Child::$var
This feature request was already brought up a couple of weeks/months
ago, please consider:
http://news.php.net/php.internals/29067
Regards
--
Etien
On Sun, May 27, 2007 at 11:35:04AM -0400, Daniel Convissor wrote:
> On Sat, May 26, 2007 at 01:50:04PM +0200, Bart de Boer wrote:
> >
> > class Base {
> > public static $var = 'hello';
> >
> > public function someFunc() {
> > echo self::$var; // Currently maps to Base::$var
>
On Sat, May 26, 2007 at 01:50:04PM +0200, Bart de Boer wrote:
>
> class Base {
> public static $var = 'hello';
>
> public function someFunc() {
> echo self::$var; // Currently maps to Base::$var
> echo $this::$var; // Should map to Child::$var
Here, and th
Hi again,
I'm aware that you can do `$a = $group . '_' . $fn; $a();`, but you can
do `$b = $group . '_' . $var; echo $$b;` as well as `echo ${$group . '_'
. $var}`. It's a mater of style, not if there is any way to get it done.
Yes I've read about 'static::' some time ago, but forgot about it
Arnold Daniels wrote:
> Hi,
>
> I agree that $this::$var isn't really logical, since $this is an object
> and not a class name. But I do not see why $class::$var shouldn't work,
> or $class::$method() for that method. You can also do $function().
>
> Also I want to suggest that brackets can be us
Hi,
I agree that $this::$var isn't really logical, since $this is an object
and not a class name. But I do not see why $class::$var shouldn't work,
or $class::$method() for that method. You can also do $function().
Also I want to suggest that brackets can be used more freely. Currently
you c
I seem to have been a bit too hasty with my previous reply... You meant
it wouldn't be able to access the static vars of the inherited Base
class?... I think that's a different feature regarding the static access
mechanism currently already in place... I'm only suggesting the ability
to refer
I understand... My suggestion would be to map $this to the class name
(of the current instance) if the Scope Resolution Operator '::' is used...
Marco Kaiser wrote:
Hi,
this doesnt work because static vars are bound to his class and are not
inherited by a child class.
maybe this would be wo
Hi,
this doesnt work because static vars are bound to his class and are not
inherited by a child class.
maybe this would be work with php6 or a other 5.x version.
(Same behavior like the singleton pattern getInstance() abstract class
stuff)
-- Marco
> Hi all,
>
> I'd like to be able to do the fol