4

I am writing this code in php

$a = 1 + 2 + 3 − 4 + 5;
echo $a;

getting error

Parse error: syntax error, unexpected '−' (T_STRING) in E:\xampp\htdocs\practice\test\index.php on line 2

what's the problem what's the right code

1
  • The problem is with this that's not a true minus sign, but a similar character. Replace it with -. Oct 26, 2014 at 13:25

1 Answer 1

8

Remove the operators and type them in again yourself. Looks like you copied them from somewhere and its not the correct operators php is expecting.

Eg. - and − are not the same thing.

3
  • 5
    Welcome to SO, where the simplest answers can make you a pointsmillionaire :) Oct 26, 2014 at 13:18
  • 1
    this shows the difference in URL encoded values between the two.
    – h2ooooooo
    Oct 26, 2014 at 13:19
  • I guess you are the STAR of StackOverflow :)
    – user3522371
    Oct 26, 2014 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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