maxudaskin Posted October 16, 2007 Share Posted October 16, 2007 Is the following correct? <?php /* Forum Variables */ $1 = "Notams"; // LINE 11 $2 = "Staff Notams"; $3 = "Staff General Discussion"; $4 = "General Discussion"; $5 = "Off Topic"; $6 = "Events"; $7 = "Screenshots"; $8 = "Real World Zoom Airlines News"; $9 = "Pilot of the Month"; $10 = "CYVR - Vancouver International"; $11 = "CYYZ - Toronto Pearson International"; $12 = "EGKK - London Gatwick International"; ?> I get the following error... Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/.grable/vzoom/virtualzoom.net/include/constants.php on line 11 Link to comment https://forums.phpfreaks.com/topic/73407-number-in-variable-name/ Share on other sites More sharing options...
kenrbnsn Posted October 16, 2007 Share Posted October 16, 2007 A variable name can not start with or be a number. Ken Link to comment https://forums.phpfreaks.com/topic/73407-number-in-variable-name/#findComment-370323 Share on other sites More sharing options...
emehrkay Posted October 16, 2007 Share Posted October 16, 2007 variables must start with a letter or underscore. make it an array if you want to reference it by number $forum_vars = array( 1=> "Notams", "Staff Notams" }; then do echo $forum_vars[3]; // Staff General Discussion Link to comment https://forums.phpfreaks.com/topic/73407-number-in-variable-name/#findComment-370325 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.