#29556 [Opn->Bgs]: inconsistent dereference using multidimensional arrays inside strings

From: Date: Mon, 16 Aug 2004 22:25:08 +0000
Subject: #29556 [Opn->Bgs]: inconsistent dereference using multidimensional arrays inside strings
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-64734@lists.php.net to get a copy of this message
ID: 29556 Updated by: iliaa@php.net Reported By: ash at aeria dot net -Status: Open +Status: Bogus Bug Type: Strings related Operating System: FreeBSD4 PHP Version: 4.3.8 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php If you store arrays inside strings surround them with {} ex. echo "{$grid[1][1]}"; Previous Comments: ------------------------------------------------------------------------ [2004-08-06 21:28:58] ash at aeria dot net Description: ------------ Arrays containing strings may be used inline as thus: $vec = array (1=>"foo",2=>"baz"); echo "$vec[1]"; Fine. However if you use a multidim array instead, you end with the 'Array' reference string. I think the RE that contcatenates text should have better judgement about where a variables key might stop. The issue is present in all the php version I have access to. Or mabe this was fixed in .9 and I missed the other bug This is my php version PHP 4.3.8 (cli) (built: Jul 30 2004 17:08:10) Copyright (c) 1997-2004 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies Exit 1 Reproduce code: --------------- <? $grid[1][1]= "textstring"; echo "$grid[1][1]"; #this outputs 'Array[1]' echo $grid[1][1]; #this works ?> Expected result: ---------------- textstringtextstring Actual result: -------------- root@sqee.aeria.net:bin}./php ~/foo.php Array[1]textstring ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29556&edit=1

« previous php.bugs (#64734) next »