0

Im trying to display the & character as its written. But it keeps converting to special symbol in html.

Example : shoutcast song title

Chas & Dave

will displayed as Chas.

Anything after the & wont display.

dur
  • 13,039
  • 20
  • 66
  • 96
da_judge
  • 9
  • 1
  • 4
  • i fixed it with this............. $xml = html_entity_decode($xml); $xml = str_replace("&", "and", str_replace("'", "'", $xml)); – da_judge Mar 09 '16 at 21:21

2 Answers2

1

You should write & as specified here: http://www.w3schools.com/html/html_entities.asp

Elcan
  • 754
  • 12
  • 23
  • i dont think i explained my self very well sorry about that. Maybe this well help... $xml = str_replace("'", "'", $xml); i want to add replace & as well to display & not special code.. cheers – da_judge Mar 07 '16 at 20:25
1

& has a special meaning in HTML, it means the start of an 'entity'. To output a & itself, use the entity &amp;. There are 5 entities common to HTML and XML, &amp;, &lt; (<), &gt; (>), &quot; (") and &apos; ('), although the last two are often only necessary in attribute values.

HTML has many others, a common one is &nbsp;, which is short for 'non-breaking space', often used to force a table cell to display.

Flynn1179
  • 11,557
  • 6
  • 35
  • 70