Hy, Im trying to insert into an array part of a string from a text file.
The text file contains characters that I wish to insert in the array. A --> * character is between each entry that I want to separate in the array. Therefore it looks like this:
When I view the sizeOf the Array it shows that I have 2 elements in the array, but in fact I only have one entry (only one * character in people.txt)Code:// Write all data to people.txt $fp = fopen ( "people.txt", "a"); fwrite ($fp, $inputString); fclose ($fp); $tokensArr = Array(); $filename = "people.txt"; // File which holds all data $fp = fopen ( $filename, "r"); $content = fread( $fp, filesize( $filename ) ); fclose($fp); $tokensArr = explode ("*",$content); echo sizeof($tokensArr);
people.txt:
Why is the size of the array 2 and not 1 ?Code:*Cooper<br>Rockstar Poser<br>No<br>




Bookmarks