php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48879 Numeric Variable Names
Submitted: 2009-07-10 12:20 UTC Modified: 2009-07-10 18:11 UTC
From: corrodedmonkee at gmail dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.2.10 OS: Ubuntu/Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: corrodedmonkee at gmail dot com
New email:
PHP Version: OS:

 

 [2009-07-10 12:20 UTC] corrodedmonkee at gmail dot com
Description:
------------
You can create variables with numeric only names with double dollars. It can be assigned data with double dollar also. 

It will not throw any errors or warnings.

Reproduce code:
---------------
---
From manual page: language.variables.variable
---

<?php

$foo = 123;
$bar = 456;
$$foo = $bar;

echo '<pre>';
print_r(get_defined_vars());

?>

Expected result:
----------------
PHP Fatal Error

Actual result:
--------------
[foo] => 123
[bar] => 456
[123] => 456

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-10 18:11 UTC] jani@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Just don't do it. And search the bug database before submitting, this 
has been reported before..
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sun Feb 08 09:00:01 2026 UTC