¶ - it is newline symbol, try this:
$result = preg_replace('/[^[:print:]]/', '', $csv_value);
This question already answered, other examples you can find on this link: PHP: How to remove all non printable characters in a string?
Question
I'm importing a CSV file, but for some reason, every line ends with the ¶-symbol... So my database is contaminated with all this symbol. And above all, it's ruining my workflows.
So I would like to strip those symbols.
I've tried with $csv_value = preg_replace( '/\s+/', '', $csv_value);
but this line of code also deleted my spaces...
How can I just remove the ¶ symbol from my $csv_value
?
Solution
¶ - it is newline symbol, try this:
$result = preg_replace('/[^[:print:]]/', '', $csv_value);
This question already answered, other examples you can find on this link: PHP: How to remove all non printable characters in a string?
OTHER TIPS
The ¶ symbol is denoted as a line break, so try this:
$csv_value = preg_replace( '/\n+/', '', $csv_value);