php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1533 try yourself...
Submitted: 1999-06-12 16:08 UTC Modified: 1999-06-12 16:12 UTC
From: thomas dot jarosch at styletec dot de Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.9 OS: Linux+Apache 1.3.6
Private report: No CVE-ID: None
 [1999-06-12 16:08 UTC] thomas dot jarosch at styletec dot de
<html>
<body>

<b><center>PHP Development zone</center></b><br>

<?
		$Configurations = array();
		$configfiles = array();
		
		$Configuration["test"] = "should be working fine.";
		$configfiles[1] = "test";
		
		echo "<b>workaround:</b> ";
		$tmp = $configfiles[1];
		echo "$configfiles[1]: $Configuration[$tmp]<br>";

		echo "<b>bug:</b> ";

		// somehow php doesn't handle the array right
		echo "$configfiles[1]: $Configuration[$configfiles[1]]<br>";
		
?>

</body>
</html>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-06-12 16:12 UTC] rasmus at cvs dot php dot net
This is a well-known limitation of quoted strings in PHP3.  Simply do:

echo "$configfiles[1]:". $Configuration[$configfiles[1]]."<br>";

You can only put simple things inside quoted strings to be expanded.  Once you start using nested stuff like that you need to do it outside the quoted string.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Mar 02 17:01:28 2024 UTC