php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #13780 At least missleading errormessage and possible a bug.
Submitted: 2001-10-21 13:32 UTC Modified: 2001-10-22 03:50 UTC
From: Draugsi at hotmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 4.0.6 OS:
Private report: No CVE-ID: None
 [2001-10-21 13:32 UTC] Draugsi at hotmail dot com
This error message is reported on your page :

Parse error: parse error, expecting `T_VARIABLE' or `'$'' in ************** on line ***

At first i thougt this was because i was "making" a 2 dimentional array or because i was doing somthing wrong in the query to MySQL but i found out the hard way that this was not the case.  To reproduce this error is pretty easy, the only ting you have to do is this :

<?php
$2dAnim="All your base are belong to us.";
?>
... just this will trigger it, to fix this error just do :

<?php
$TwoDAnim="All your base are belong to us.";
?>

Apparently if you have a digit as the first char in a variable you will get this error message.

It would of been nice if i could have found some information about this, but instead i sat for "two" days trying to figure out how i screewd up the Multidimensional array or the Query.

Regards,
  Draugsi.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-21 13:48 UTC] derick@php.net
This is not a bug, but should be in the manual. Changing category.

Derick
 [2001-10-22 03:49 UTC] goba@php.net
This IS in the docuemtation, and clearly explained.
See: http://www.php.net/variables

Quote:

| Variable names follow the same rules as other
| labels in PHP. A valid variable name starts
| with a letter or underscore, followed by any
| number of letters, numbers, or underscores.

From the examples list on the same page:

| $4site = 'not yet'; // invalid; starts with a number

There is nothing more we can do about this IMHO.
 [2001-10-22 03:49 UTC] goba@php.net
Ups, forget to Bugusify...
 [2001-10-22 03:50 UTC] derick@php.net
Then make it bogus...

Derick
 [2003-05-15 08:20 UTC] tamijo at tamityville dot com
This posting just saved me from going completely over the 
edge. I was using the variable $2d and getting the same 
error and could NOT find the bug. I did nothing more than 
change the variable to include an alphabetic start and 
BOOM--Christmas came early. Thank you Draugsi!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 06:01:29 2024 UTC