NYCPHP Meetup

NYPHP.org

[nycphp-talk] $$ question

Hans Zaunere lists at zaunere.com
Wed May 25 22:17:17 EDT 2005


> I have a question about interpreting $$variable.
> 
> I have this:
> $concerts2006 = array(
> array("January 28","Cypress Club - West Palm Beach, FL"),
> );
> 
> and then I have this:
> function showSchedule( $year ) {
> ....
> $list = 'concerts' . $year; // this gets 'concerts2006' ok when called with
> 2006
> $num = count( {$$list} ); // but this does not get count( $concerts2006 )
> ....
> <?php echo $$list[$i][0]; ?></td> // so of course this doesn't work
> 
> So the problem is at $$list.  It doesn't seem to matter whether I have
> {$$list} or just $$list.
> 
> I also seem to remember from somewhere that the $$list[][] never works but
> I couldn't find it in the docs.
> 
> Help??  Thanks.

$concerts2006 = array(array("January 28","Cypress Club - West Side!"));

function showSchedule( $year ) {

   $list = 'concerts'.$year;

   $num = count($GLOBALS[$list]);

   echo $num;
}

Ehh, right?






More information about the talk mailing list