NYCPHP Meetup

NYPHP.org

[nycphp-talk] static variable variable?

Ken Robinson kenrbnsn at rbnsn.com
Thu Dec 20 07:26:35 EST 2007


At 10:13 PM 12/19/2007, Michael B Allen wrote:
>I have a bunch of subclasses that define a static varible that I need
>to access in the parent class. So I'm trying something like:
>
>$_staticvarname = get_class($this) . '::$_staticvar';

Try using double quotes instead of single quotes:

$_staticvarname = get_class($this) . "::$_staticvar";

Variables are not evaluated when surrounded by single quotes

Ken 




More information about the talk mailing list