php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #39501 Docs incorrectly explain the rules for naming variables and constants
Submitted: 2006-11-13 16:59 UTC Modified: 2007-08-17 12:08 UTC
From: z_rules55 at hotmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
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: z_rules55 at hotmail dot com
New email:
PHP Version: OS:

 

 [2006-11-13 16:59 UTC] z_rules55 at hotmail dot com
Description:
------------
As I had previously reported here (http://bugs.php.net/bug.php?id=39150), PHP does in fact allow the creation of variables and constants with names that contain invalid characters. As far as I can tell, PHP will let you create a variable or constant with any string whatsoever, even a binary one. Whether or not it is desirable to allow this behavior is not the point of this report; but if it is desirable, or if it's not going to be fixed, could the docs please be updated to clarify the fact that you *can* use invalid variable/constant names?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-17 12:08 UTC] vrana@php.net
$GLOBALS['2a'] is an array key which is not restricted. define() documentation doesn't restrict name either. Only for handy use through $var_1 or CONST_1 rules are defined in the language chapter.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 23:01:32 2025 UTC