0

So what I am trying to do is make an if statement (for now the numbers wont change) but when I run the code it says "Parse error: syntax error, unexpected 'echo' (T_ECHO) in {root} on line 8" How can i fix this?

<?php
    $get_id='1';
    $imageid = '1';
    $imagepath = 'http://localhost/images/p.png';
    
    
    if($get_id == $imageid){​​
      echo '<div class="box2"><img src='.$imagepath.'></div>';
    }​​ else {​​
      echo "<div class='box2'>No profile picutre set</div>";
    }​​
    ?>

  • Tell us the exact error message not part of it – ADyson Jan 07 '21 at 08:31
  • Parse error: syntax error, unexpected 'echo' (T_ECHO) in {root} on line 8, but I cannot see any semicoloms or closing mistakes.. – The one and only newby Jan 07 '21 at 08:32
  • 3
    When I copy&paste your code into the editor of https://3v4l.org/, it shows errors like this, https://i.stack.imgur.com/leDXz.png - so you appear to have some “invisible” characters in those positions. Re-type the code in those places to remove those. – CBroe Jan 07 '21 at 08:36
  • 1
    To be precise, there are two "ZERO WIDTH SPACE"(s) (U+200B) after the if- and else-statements. (And the same after the final `}`.) (You can see them using [this tool](https://www.soscisurvey.de/tools/view-chars.php).) – Ivar Jan 07 '21 at 08:38
  • 2
    I rewrited the code and it indeed solved the problem... Guess Microsoft teams isn't a good sharing platform for codes... – The one and only newby Jan 07 '21 at 08:39
  • You had unexpected chars after all the `{` and `}` bracket, sounds like maybe an editor issue of possible a unix/windows line ending issue or maybe an UTF-8 all the way through issue – RiggsFolly Jan 07 '21 at 08:46

0 Answers0