Forum Moderators: coopster

Message Too Old, No Replies

Error T_string

         

scotch33

2:19 pm on Sep 18, 2005 (gmt 0)



Hi - just programming my first php script. I keep getting this

Parse error: parse error, unexpected T_STRING in /home/hosting-0/public_html/devsite/avo01/results.php on line 14

line 14 is

$time_a = “The earlier people are on the road the higher their risk rating. Up to 20% of drink drive convictions are currently ‘morning after’, on their way to, or at, work. If your company instigated the ‘journey purpose’, then the company shoulders some of the liability if anything goes wrong.”;

can someone help

grandpa

2:51 pm on Sep 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi scotch33. Welcome to WebmasterWorld and the world of PHP programming.

Someone please corect me if I'm wrong, but I believe unexpected T_STRING is shorthand for unexpected Termination String.

<snip>

On further review :)

It appears that your quotes are not really quotes at all. Try starting and ending the string with literal quotes (").

mcibor

4:42 pm on Sep 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need the quotes, not the commas!

This is the corrected string declaration:

$time_a = "The earlier people are on the road the higher their risk rating. Up to 20% of drink drive convictions are currently 'morning after', on their way to, or at, work. If your company instigated the 'journey purpose', then the company shoulders some of the liability if anything goes wrong.";

Moreover you cannot use the same quotes: " or ' in the middle of the string unless you they are following the \ sign:

$string1 = "This is the double quote: \"<br>";
$string2 = 'This is the single quote: \'<br>';
$string3 = "And this is the slash sign: \\";

Best regards
Michal Cibor