>Start from scratch. You have a file with a single user on each line: > >tom\n >dick\n >harry\n > >You use file() to read into array $users. > >You compare as in above. > >You add a user by: > > $users[] = "NEW_USER\n"; > >You write out the file as above.
curious... when I ran through that (before posting initially) was getting the following from print_r of the file() results... Array ( [0] => admin [1] => user1 [2] => user2 [3] => user3 [4] => ) which lead me to believe that the last \n was parsing as an extra element in the array... (not sure why), thus the dilema of either trimming each element of the array, or pop'ing an element off the end of the array. both seemed annoying, thus the post after recoding it with each/trim into new array and use that for checking validity... I redid the original file using the script and got different results; Array ( [0] => admin [1] => user1 [2] => user2 [3] => user3 ) which is what I expected in the first place... as such, the original code could now just check for the username with a ."\n" on the end (as you recommended). Futsed up there somewhere... thus the seemingly stupid question. cheers, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php