0

I get a " Parse error: syntax error, unexpected" error for whatever I print.

The error "Parse error: syntax error, unexpected '"test"' (T_CONSTANT_ENCAPSED_STRING) in C:\xampp\htdocs\firstfile\test.php on line 3"

The code I tested

<?php

 echo 'test';

  
 ?>

A basic code, but the error persist.

How to solve this problem?

0

1 Answer 1

1

Could it be that what you posted is not the actual file that is executed? Certainly that file is fine syntactically, so there must be some stupid mistake somewhere. I see that the faulty file is inside a folder firstfile. You are really sure this posted file is that file inside the folder?

What is especially outstanding here are the double quote chars in the error message which simply are not present in the file you posted.

When an error like this remains unchanged whatever you do, then typically you edit the wrong file.

Sign up to request clarification or add additional context in comments.

9 Comments

Thank you for the reply. I tried to make many files an folders, but no use. I will try to reinstall "xampp". It was the last resort.Thanks.
Ok, but the idea is not to make many attempts in the hope that something works, but to narrow the issue down. I suggest you remove all files from the htdocs folder, really wipe it, not just a bit. Then make a test request which should give an error "not found". Then create a single new file and request that.
I tried that, but the same error occurs. I tried to change the encoding to "UCS-2" and then return it to ANSI again, and the file worked like a magic!. I really have no idea what the cause of the problem. But thanks your comment gave me a hint to try that.
Which encoding did you change?
The test.php file from ANSI to "UCS-2 and then returned it back.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.