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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
24 + 42 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Apr 19 05:01:29 2024 UTC