Christoph Eder Christoph Eder - 1 month ago 8
PHP Question

Defining simple string in PHP wont work..

I am a PHP programmer since 12 years now, but i run out of my possibilities now.
I never had such issue, and i dont know, what's going wrong there.

It is really simply. I want to declare the number 84367 as a variable.

I minimized my script to 1 line, in a new php file, but.. what is going wrong?!

<?php
$x = "84367"‬;
?>


results in


Parse error: syntax error, unexpected '‬' (T_STRING) in C:\xampp\htdocs\me7dtc\test.php on line 2


Why ?

Answer

Simple. Your code contains unicode characters.

Copy and paste this exactly as shown:

<?php
// $x = "84367"‬; 
              ^ is the unicode quote.

$x = "84367";
?>

The commented line is the one that contains the unicode characters.

  • To be more specific, it's the last quote.
Comments