I have the following code
$s = '\n [email protected] \n ';
$s = str_replace('\n', '', $s);
echo $s;
I want to replace the '\n' char with '' but it's not working with the above code. I have found that as \n is the new line char with ascii value 10 by echo ord(substr($s, 0, 1)); it is not working. It's not clear to me what is the exact reason behind not working the above code. please help.
trim()might be the function you're after instead ofstr_replace().