redhead
10-13-2002, 02:18 PM
hello. ive been doing a little (make that... very little) php for a while now... but i need some help...
i need to search through a text file for a string... and if its there it needs to print which line it is on.
ive used something similar to this to search a file in the past...$array = file("example.txt");
if (in_array("What I'm trying to find",$array)) {
print "What I'm trying to find is in the file";
}but it needs to print which line it finds the string on.
thanks in advance... :thumbsup:
i need to search through a text file for a string... and if its there it needs to print which line it is on.
ive used something similar to this to search a file in the past...$array = file("example.txt");
if (in_array("What I'm trying to find",$array)) {
print "What I'm trying to find is in the file";
}but it needs to print which line it finds the string on.
thanks in advance... :thumbsup: