-3

I've a problem with this code:
<meta property="og:url" content="<?= echo 'http://' .$_SERVER['SERVER_NAME']. '/' .$_SERVER['PHP_SELF']; ?>" />

ERROR: Parse error: syntax error, unexpected 'echo' (T_ECHO)

please help

Pedro Lobito
  • 85,689
  • 29
  • 230
  • 253
John_Magdy
  • 23
  • 8

2 Answers2

0

Remove the equal sign (=) after the PHP opening tags <?= should be <?

Sterling Beason
  • 612
  • 6
  • 12
0

With <?= this = means its already going to echo anything inside of the tags.

You can either remove the = or remove the echo

So it should either look like this:

<meta property="og:url" content="<?= 'http://' .$_SERVER['SERVER_NAME']. '/' .$_SERVER['PHP_SELF']; ?>" />

or like this:

<meta property="og:url" content="<? echo 'http://' .$_SERVER['SERVER_NAME']. '/' .$_SERVER['PHP_SELF']; ?>"

Derek
  • 2,674
  • 1
  • 17
  • 30