By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,728 Members | 1,404 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,728 IT Pros & Developers. It's quick & easy.

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'

P: 6
on line 4

Expand|Select|Wrap|Line Numbers
  1. $your_data = "
  2. <?php
  3. $config = Array();
  4. $config['w2box_title'] = "files";
  5. ?>";  $fp = fopen("users/".$username."/config.php", "w");  fwrite($fp, $your_data);  fclose($fp);


there seems to be a problem with the $ symbol


what i am doing is when you click a button it will write a certain file with the code:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $config = Array();
  3. $config['w2box_title'] = 'files';
  4. ?>
May 7 '10 #1
Share this Question
Share on Google+
3 Replies


P: 8
You're mixing up your quotes.

Since you started the string with " you can only use ' to quote things inside, otherwise you'll get a parse error.

Basically, around files, you should be using ' and not "
May 7 '10 #2

P: 6
what about the $
May 7 '10 #3

P: 8
@jamietrent
Why do you think it's the $?

Everything between the " on Line 1 until the first " on Line 4 is being considered a string. So after the first " on Line 4, the parser is expecting you to terminate the line with a ; or concatenate with a . and more information.
May 7 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.