1

I am parsing a text file using PHP and one of the lines contains simple numeric characters. However, I came across a file that for some reason contains other "hidden" characters as part of this number.

I came upon this thread php var_dump(); result php string(4) "1" which hints that there might be multibyte characters but there is no solution.

Debugging

echo 'line:' . $line . '<br/><br/>';
var_dump($line);
var_dump(ord($line).'|'.ord('1').'|');
var_dump(chr(ord($line)));

Here's the output

line:1
string(4) "1" string(7) "239|49|" string(1) "�"

Is there a good PHP solution that would help eliminate random junk characters in a string?

Denis
  • 322
  • 1
  • 4
  • 15
  • 2
    Does this answer your question? [PHP Multibyte String Functions](https://stackoverflow.com/questions/661832/php-multibyte-string-functions) – Markus Zeller May 14 '23 at 17:59

0 Answers0