I am having trouble doing a simple str_replace
.
I am trying to remove all comma's from a string, which does work. But when I try to alter the string again, the commas reappear somehow. I refactored my code to ensure I didn't cause this.
Anyways here is my code. Can anybody spot a bug?
$delim=remDelim(fgets($fo));
# echo 'before : '.htmlspecialchars($delim);
$delime =str_replace(",",",",$delim);
echo 'after : '.htmlspecialchars($delime);
$delimed = str_replace("<","",$delime);
echo $delimed.'<br />';
example output:
Jose, jr to Jose, jr to Jose, jr
Its like my string is being unconverted somehow. I would say that it was most likely I got the names mixed up and used the first string to craft the last. But alas I can see that is not the case.
If you're viewing this in a browser, note that the browser WILL render the character entities as the actual character, not the entity text. Either force the browser into plain-text mode (header('Content-type: text/plain');
), or view the page's source (e.g. ctrl-u in firefox)