Bug #15378: 3d array variables not usable in double quotes

From: Date: Tue, 05 Feb 2002 05:30:40 +0000
Subject: Bug #15378: 3d array variables not usable in double quotes
Groups: php.dev 
Request: Send a blank email to php-dev+get-79176@lists.php.net to get a copy of this message
From: php.net@chiefworks.com Operating system: Linux 2.4, Apache 1.3.22 PHP version: 4.1.1 PHP Bug Type: Arrays related Bug description: 3d array variables not usable in double quotes <?php $var = array( 'name' => array( 'first' => 'Caleb', 'last' => 'Maclennan' ) ); echo "My first name is $var[name][first]!"; ?> Acutal Result: My first name is Array[first]! Correct Result: My first name is Caleb! This get's really nasty when useing 3 dimentional arrays to put data in SQL querys. The above example can easily be done by takeing the variable out of the quotes and useing "." to add it to the end, but there are other cases where the only solution is to do like this: <?php $tempVar = $var[name][first]; echo "My name is $tempVar"; ?> -- Edit bug report at http://bugs.php.net/?id=15378&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=15378&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=15378&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=15378&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=15378&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=15378&r=support Expected behavior: http://bugs.php.net/fix.php?id=15378&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=15378&r=notenoughinfo

« previous php.dev (#79176) next »