this is my code:
$content = str_replace("×", "x", $content);
The problem that i can replace any word but I can't replace something like × how can solve this issue ?
Be known that × is not x letter it's a symbol.
this is my code:
$content = str_replace("×", "x", $content);
The problem that i can replace any word but I can't replace something like × how can solve this issue ?
Be known that × is not x letter it's a symbol.
What you are trying to do is called transliteration, heres a similar thread: How to convert special characters to normal characters?
this may work:
$content = iconv('utf-8', 'ascii//TRANSLIT', $content);
I'm not sure why your approach isn't working for you because I tested it on phpfiddle.org, and this works:
<?php
$content = "some string with × symbol";
$content = str_replace("×", "x", $content);
echo $content;
?>
I also tested
preg_replace
on:
http://www.phpliveregex.com
and this works:
preg_replace("/×/", "x", $input_lines);
Its always best to wrap strings in single quotes when they don't have special characters intended to be interpreted by PHP. If this issue is due to PHP interpreting the × symbol for some reason, this will fix it:
$content = str_replace('×', "x", $content);