Click here to Skip to main content
15,901,283 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

what is the output of this php code?
PHP
$a="&#57";

echo $a


one of my friend wants to print "&#57"
and the output shows 9.

why such type of output happens?
Posted

1 solution

since HTML encode of 9 is equivalent to "&#57" . thatswhy it's printing 9. for printing original text, it requires to define as &#57 then it generates correct output.

PHP
$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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900