kurama kurama - 3 months ago 12
MySQL Question

remove <> automaticly in my php files

I call for example this element

SEND_EXTRA_ORDER_EMAILS_TO
form my database

SEND_EXTRA_ORDER_EMAILS_TO = test<test@test.com>


when I write in my php code an
echo
,
print_r
or
var_dump


eg
var_dump(SEND_EXTRA_ORDER_EMAILS_TO)
it write only test.
do you have an idea how to resolve this element be cause it's make to send an email

I use php 7 and mysql 7

Tk

Answer

You can use htmlspecialchars() to escape the string so your browser wont treat your string as HTML.

$code = "<h1>Hello world</h1>";
echo htmlspecialchars($code);
// Will output <h1>Hello world</h1> without rendering the HTML in the browser