1

MY code is quite simple.

<?php
    echo "hello world";
?>

and i get this message

Parse error: syntax error, unexpected 'world' (T_STRING) in /usr/local/zend/apache2/htdocs/index2.php on line 2

al'ein
  • 1,711
  • 1
  • 14
  • 21
bigextra
  • 45
  • 2
  • try replacing double quotes with single ones.... – Dimitris Papageorgiou Oct 16 '15 at 17:44
  • That is valid code. Do you have any hidden characters in there? Did you forget the quotes? – Josh J Oct 16 '15 at 17:46
  • You probably have some invisible characters in your string. Try replacing the "hello world" with something you typed out, maybe you copied /pasted some bad stuff. – lrossy Oct 16 '15 at 17:48
  • single quotes gives the same thing, and no no hidden characters... ive been stuck on this for like 2 hours now banging my head against the wall.... – bigextra Oct 16 '15 at 17:48
  • Are they curly or straight quotes? OS X uses curly quotes by default (including in TextEdit), which PHP doesn't like. – Andrea Oct 16 '15 at 17:50
  • no, no hidden characters... just made a new file and re typed it all by hand and still same error – bigextra Oct 16 '15 at 17:50
  • hah they are curly quotes.. i bet thats the problem... what text editor should i use for php? – bigextra Oct 16 '15 at 17:51
  • @bigextra Take a look at sublime: http://www.sublimetext.com/ – Ian Drake Oct 16 '15 at 17:54
  • [The code in your question works](https://eval.in/452216), but the one in your home environment doesn't. It means you should copy and paste it, entirely, inside some Unicode supported online pastebin and show it to us, because clearly there are some hidden char problems there. – al'ein Oct 16 '15 at 17:54

1 Answers1

2

I just copied the code from above on this page because it has the straight bar quotes instead of the curly quotes. I pasted this back into text editor... and wala! it work! thanks guys for the help!!! whoever said the idea about the quotes, i am one upping you or however this site works.

bigextra
  • 45
  • 2
  • 1
    You answered your own question, so you should accept your own answer! :) – al'ein Oct 16 '15 at 17:56
  • In TextEdit, open Preferences and on the bottom there is a checkbox about Smart Quotes. If you uncheck that box it will work. Also switch it to plain text instead of rich text. – Josh J Oct 16 '15 at 17:58