Join the Stack Overflow Community
Stack Overflow is a community of 6.6 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

This question already has an answer here:

I have searched online for hours and haven't found anything that fixes my error. I have a file with this code,

<?php
   class Conn {
   public static $dbhost = “localhost”;
   public static $dbuser = " < provide here user name to your database> ";
   public static $dbpass = "< password you use to access database >";
   public static $dbname = " <database name> ";
   }
?>

and here's my error, Parse error: syntax error, unexpected 'here' (T_STRING), expecting ',' or ';' in /Applications/XAMPP/xamppfiles/htdocs/Registration/Conn.php on line 4

I've tried changing " to ' yet it doesn't help!

I don't have any open strings, so what's the problem???

share|improve this question

marked as duplicate by Fred -ii-, Rizier123 php Jun 30 '15 at 23:09

This question was marked as an exact duplicate of an existing question.

    
curly quotes are killing your code – Fred -ii- Jun 30 '15 at 23:06
1  
That is the curly quotes in $dbhost=“localhost” – Norbert van Nobelen Jun 30 '15 at 23:08
    
That doesn't fix it – nathan Hunsberger Jun 30 '15 at 23:09
    
here copy/paste this "localhost"; these types of questions are off-topic btw – Fred -ii- Jun 30 '15 at 23:09
    
ideone.com/V66mNp shows no problems after replacing curly quotes – ssnobody Jun 30 '15 at 23:10
up vote 0 down vote accepted

If you look at your code example, you can see you are using two different types of quotation marks. "localhost" is wrapped in curly quotes (“”), and not normal quotes. ("") This is causing the parsing error.

The difference:

“localhost”
"localhost"
share|improve this answer
    
I tried yet it doesn't change the error! – nathan Hunsberger Jun 30 '15 at 23:14
    
Could you post the new code, as you did in your original post? – true Jun 30 '15 at 23:14
    
The error seems to be stemming from how you are using this class. What code is accessing these public members prior to the error being thrown? – true Jun 30 '15 at 23:22
    
Ok so my browser was apparently not updating the code, just had to quit and restart and it was all fixed, THANKS!! – nathan Hunsberger Jun 30 '15 at 23:24
    
That's great! Glad I could help. Be sure to mark this answer as accepted if this was the solution. :) Thanks! – true Jun 30 '15 at 23:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.