NYCPHP Meetup

NYPHP.org

[nycphp-talk] $$ question

Nasir Zubair nasir81 at gmail.com
Wed May 25 16:44:15 EDT 2005


Well, according to php manual, the braces are used in the following fashions:

$$var
${$var}

I can't find {$$var} syntax, neither does it work. it throws a syntax error.

>From that, the following code works for me on an php 4.3.11 machine:

$num = count( ${$list} );
echo ${$list}[0][0];

Hope that helps.

On 5/25/05, Michael Southwell <michael.southwell at nyphp.org> wrote:
> 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.
> 
> 
> Michael Southwell, Vice President for Education
> New York PHP
> http://nyphp.org/twoday - In-depth PHP Training Courses
> 
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
> 


-- 
Nasir Zubair
http://www.nasir.us/



More information about the talk mailing list