I am trying to get a Random word from a .txt file I wrote with Notepad.
To do that:
1.I Open the File.
2.I Get a random position for $fp:
$size=filesize($dictionary);
$rand_location=rand(0,$size);
fseek($fp,$rand_location);
3.I use $word=fgets($fp, 7) to get a 6 caracter long word...
4.Strangely I get an only 3 visible caracter word plus some kind of null caracter hidden...
i.e.: lets assume that I pick the string 'abc' from the file, in order to trouble-shoot I do the following:
echo $word; // and I get 'abc'
$word=addslashes($word);
echo $word; // and I get '\0a\0b\0c'
strlen($word); // I get '6'
This have me quite confused and I have no clue with this happens. Any hint is more than Welcome
Br
El Vasco