php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #228 echo $value and echo $$value
Submitted: 1998-04-02 01:15 UTC Modified: 1998-04-02 09:10 UTC
From: steve at eyekon dot com Assigned:
Status: Closed Package: Other
PHP Version: 3.0 Release Candidate 3 OS: Solaris 2.6 Sun
Private report: No CVE-ID: None
 [1998-04-02 01:15 UTC] steve at eyekon dot com
Here is a short script which works fine in PHP 2 but not in 3. I have looked in the FAQ and the bug database, but did not see anything on this particular problems:

<?
$new = "One";
$$new = "Two";
echo "1: $new<br>2: $$new<br>";
echo "1: $new<br>2: $One<br>";
?>

on PHP3 produces the output: (bad.. I think)

1: One
2: $One
1: One
2: Two

and on PHP2 produces: (Good... or was)

1: One
2: Two
1: One
2: Two

So... is this a bug or feature? Sorry if it's been covered!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-04-02 09:10 UTC] andi
In PHP 3.0 you can use ${$value}.             
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 11:01:29 2024 UTC