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 used more freely. Currently
> you can use ${$group . '_myvar'}, but you can't do the same for
> functions and classes. It would be great if you could use {$group . '_'
> . $fn}() and {get_class($this)}::$var.
> 
> The way to solve this problems right now is to use eval('return ' .
> get_class($this) . '::$var;') for getting the value. Getting a reference
> to the variable to set it, is even more messy. You need to do something
> like eval('$cvar =& ' . get_class($this) . '::$var;'); $cvar = 'bye';.
> 
> Anyway, it is not so nice, but doable in user space fairly easily. So I
> don't see why anything needs to be added in PHP 5. It would be nice to
> have a better method in PHP 6 though.
> 
> From Holland with love,
> Arnold

Hi Arnold,

<?php
$a = $group . '_' . $fn;
$a();
?>

As for get_class($this)::$var it pays to search the mailing list
archives.  the static:: keyword is being using in PHP 6 to do exactly
what you want from within a class.  Outside of a class, $var::$value
doesn't work yet, but the implementation of static may make it possible
to implement $var::$value as well.

Greg

P.S. The list archives are http://marc.info/?l=php-dev and are searchable

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to