Search text file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
CerIs
Forum Newbie
Posts: 22
Joined: Sat May 29, 2004 9:20 am

Search text file

Post by CerIs »

Can anyone point me on the right direction on how to search a text file for a unique value? Ive been looking for a simple tutorial but cant find one.
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

look into fopen(), and fgets()
this will open a resource stream and fgets will feed the contents of the file into a $var
then once you have the string use eregi to search for it
and maybe if it is in the file use stripos() to find out where it is.....
best of luck...just use the manual like your best friend because it really is
Post Reply