I have written the below code:
<?php
$text = 'class§ion';
echo $text;
?>
But upon executing its giving me class§ion on my browser. Unable to understand why §ion is displaying as §ion. Can any one help me?
I have written the below code:
<?php
$text = 'class§ion';
echo $text;
?>
But upon executing its giving me class§ion on my browser. Unable to understand why §ion is displaying as §ion. Can any one help me?
§
is a HTML entity, so you must use htmlspecialchars
or htmlentities
before outputting this to the browser. For the difference between these 2 functions, please see this answer.
Your code could be rewritten to the following:
<?php
$text = 'class§ion';
echo htmlspecialchars($text);
?>