It may be a stupid question but I really can't figure it out ... I need to convert a string to html entities, let's take for example:
"cTm ❂ oNe"
If I use http://www.freeformatter.com/html-escape.html#ad-output to convert it I get: "cTm ❂ oNe"
which is what I need but if I use php: http://sandbox.onlinephpfunctions.com/
$x = 'cTm ❂ oNe';
echo htmlentities($x);
Tried in CLI as well:
$ cat test2; echo ""; echo ""; php test2
<?php
$x = 'cTm ❂ oNe';
echo htmlentities($x);
?>
cTm ❂ oNe
without a success, what I'm doing wrong here ? Thank you!
$ php -v
PHP 5.4.45-0+deb7u2 (cli) (built: Oct 17 2015 08:26:31)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v5.0.15, Copyright (c) 2002-2015, by ionCube Ltd.