0

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?

Michiel
  • 7,855
  • 16
  • 61
  • 113

2 Answers2

1

¶ - 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?

Community
  • 1
  • 1
galkindev
  • 156
  • 4
0

The ¶ symbol is denoted as a line break, so try this:

$csv_value = preg_replace( '/\n+/', '', $csv_value);
JWMarchant
  • 356
  • 2
  • 8