NYCPHP Meetup

NYPHP.org

[nycphp-talk] Passing array elements as... strings?

Daniel Convissor danielc at analysisandsolutions.com
Thu Jan 4 12:04:42 EST 2007


On Thu, Jan 04, 2007 at 11:39:08AM -0500, csnyder wrote:
> 
> I thought that $value = $foo->{$key} might work, but it doesn't.

Perhaps you can split the submission into two parts?

$bar = array( 0=>'quiz', 1=>'quuz', 2=>'quux' );
$var = 'bar';
$key = 1;
echo ${$var}[$key];

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409



More information about the talk mailing list