convert any html character to encoded format in php

$cleanedName = htmlspecialchars($cleanedName); // Allow special chars, but store them safely.

 

eg. it will convert <html> to &lt;html&gt; that is safe for storing in database etc.

 

https://www.php.net/manual/en/function.htmlspecialchars.php

About Me
aman-jaiswal-image
Hello! I'm Aman Jaiswal, a web developer passionate about building efficient and reliable web applications. I specialize in PHP and Laravel development and have experience working with clients worldwide through freelance platforms. I enjoy solving real-world problems, customizing web solutions, and continuously learning new technologies in the web development ecosystem.
Let's Discuss Your Project
Prefer email? Contact me directly at contact@amanjaiswal.in