|  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 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:
Solve the problem:
1 + 26 = ?
Subscribe to this entry?

 [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)


Add a Patch

Pull Requests

Add a Pull Request


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";
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Sep 23 08:01:24 2023 UTC