I want to change the string "T Shirts Vests" into "TShirts Vests". I have tried this:
$item['menu_3'] = str_ireplace("T Shirts Vests", "TShirts", $item['menu_3']);
But str_ireplace doesn't seem to be able to handle that. How should I do this?
$item['menu_3'] = str_ireplace("T Shirts Vests","TShirts Vests", $item['menu_3']);
str_replace will work fine too by the way.
str_replace really just does that. It could fail if a character is not what you expect it to be. Like, there could be an invisible character in the string.$item['menu_3'] are, we cannot help you. Please var_dump($item['menu_3']) and update your question to include the output.$str = "T Shirts Vests";
$str[strpos($str, " ")] = '';
T Shirts Vests becomes TShirtsVests, which I don't think is what he's after.
$item['menu_3']). Please edit your question to include it.