-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
  • 94,083
  • 31
  • 258
  • 268
John_Magdy
  • 23
  • 8

2 Answers2

0

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

Sterling Beason
  • 622
  • 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,927
  • 3
  • 20
  • 33