I'm trying to display "<"/">" as String in HTML not as a tag.
I have a database that contains user's Fullname and Email and when I want display them both I have a format like this:
Christian Eric Paran <[email protected]>
but I it only display like this:
Christian Eric Paran
is there a way to Display this in HTML from PHP?
Represent characters with special meaning (< → < & & → & being the ones you need to worry about in text nodes) in HTML using character references.
The htmlspecialchars function will convert for you.
print htmlspecichars("Christian Eric Paran <[email protected]>");
Problem is, the < and > are used by HTML to delimit tags. The email address thus ends up parsed as an HTML tag, and ends up hidden by most if not all browsers.
Use < to display a < in HTML, and > for >.
If the data will be dynamic, use htmlentities or htmlspecialchars to do the above encoding for you prior to printing it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With