since HTML encode of 9 is equivalent to "9" . thatswhy it's printing 9. for printing original text, it requires to define as &#57 then it generates correct output.
$a="&#57";
echo $a
One more thing concluded from this code is to print ASCII character, use &# with their ASCII values either with PHP or any HTML enabled editor.