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 Quote 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 Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/73407-number-in-variable-name/#findComment-370325 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.