-3

I am trying to fopen() a debugging text file, which I have simply named debug.txt and put it on my desktop. I am using PHP. My code is simply

‪$debug_file = fopen( "C:\\Users\\joe\\Desktop\\debug.txt", "w" );

I keep getting this error

Parse error: syntax error, unexpected '$debug_file' (T_VARIABLE) ` on line 755, which is the line of code above.

I have checked the code before this line for a missing semicolon, as that often is the source of a syntax error, but the previous code is fine. If I comment out my one line of code, the PHP file no longer gives a syntax error.

I was thinking that there is something wrong with the way I write the string literal file path to open. I have tried to make it ok by escaping the backslashes. I'm using Windows 10. But that hasn't fixed the problem. For the life of me I can't figure out what the syntax error is.

Thanks for any help.

EDIT: As requested, the previous lines of code are:

add_shortcode('hide-it', 'hide_it_func');
function hide_it_func(){
    return;
}
Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
LeonardShelby
  • 105
  • 4
  • 14
  • Actually show the line or two of code above; it could also be missing brackets of similar – Mark Baker Nov 30 '15 at 20:16
  • What you have is: [LEFT-TO-RIGHT EMBEDDING](http://www.fileformat.info/info/unicode/char/202a/index.htm) before your dollar sign; Just retype the entire line and you should be fine. – Rizier123 Nov 30 '15 at 20:17
  • 2
    Show the previous code lines. You **ARE** missing something. line 755 is just the first place that the missing something became relevant. – Marc B Nov 30 '15 at 20:21

1 Answers1

-2

The problem is the line(s) above, you either didn't end it with a semicolon or there's an open bracket, or something along those lines.

ajacian81
  • 7,419
  • 9
  • 51
  • 64
  • Not sure why this is a -2. I've developed for PHP for 8 years now and that's always the first thing to check! – ajacian81 Nov 30 '15 at 20:25
  • 3
    This is not a good answer because it is speculation, and at the time of writing, there was not enough information in the question for this answer. This may be better as a comment. – Whymarrh Nov 30 '15 at 20:30
  • However, it was the correct answer, because this is the correct answer almost 95% of the time. – ajacian81 Nov 30 '15 at 21:32
  • 3
    NO, the answer is not correct. It was a character on the same line causing the problem. – Rizier123 Nov 30 '15 at 21:34