Answer the question
In order to leave comments, you need to log in
PHP: strlen and first line from file
In the loop I read the words line by line, here is part of the code
$word = file("word.txt");
$word = str_replace("\r\n", "", $word);
echo "===".strlen($word);
Answer the question
In order to leave comments, you need to log in
BOM sequence? What encoding is shown? Notepad++ allows you to control it quite precisely. Set "UTF-8 without BOM".
Code for cutting out a BOM from a string:
$bom = pack("CCC", 0xef, 0xbb, 0xbf);
if (0 === strncmp($str, $bom, 3)) {
echo "BOM detected - file is UTF-8\n";
$str = substr($str, 3);
}
(taken from here )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question