php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #152 Numerical Variables Illegal (Evil?!?)
Submitted: 1998-03-06 16:15 UTC Modified: 1998-04-02 09:06 UTC
From: maddox at ican dot net Assigned: zeev (profile)
Status: Closed Package: Parser error
PHP Version: 3.0b6 OS: Linux 2.0.32 (redhat 5)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: maddox at ican dot net
New email:
PHP Version: OS:

 

 [1998-03-06 16:15 UTC] maddox at ican dot net
Hi There,
Well it seems that PHP3 doesn't like variables or indirect variables which are numeric.
Unfortunately, This was a feature in PHP/FI 2.0.1 that I used extensively.
(It was handy for while loops)

<?
  $test = 1;
  $1 = "testing";
  echo $$test;
?>

This spits out the result of: Parse error: parse error, expecting `STRING' or `'{'' or `'$'' in /home/httpd/html/rocky/puritytest.php3 on
line 3

It gives me an Illegal variable if I would use $$test in an if statement as:

<? if ($$test == "testing") {
     echo ("TRUE");
   }
?>

All this stuff works in PHP/FI 2.0.1 (with PHP/FI syntax of course)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-04-02 09:06 UTC] andi
I believe this is intentional.

Andi: Yeah it is, but you could do the following: 
$i = "$j";
$$i
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC