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?

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.