Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Searching stuff.
Index -> Programming, PHP -> PHP Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Apage43




PostPosted: Fri Nov 28, 2003 12:45 pm   Post subject: Searching stuff.

I want to search a text file for a string. Like a search engine, and want to get the line numbers of all matching lines, what would be the best way to do that? I've used grep to do it, but I think that makes my script OS dependent.
Sponsor
Sponsor
Sponsor
sponsor
Blade




PostPosted: Mon Dec 01, 2003 3:23 pm   Post subject: (No subject)

whatif you read each line into an array then search the array for the file and record the element number each word is in?
Homer_simpson




PostPosted: Mon Dec 01, 2003 10:31 pm   Post subject: (No subject)

or make up a function like i made for turing called wordseparator or something that separates the works by space or any other separators... so u can search yer string for words or even sentences....
Blade




PostPosted: Tue Dec 02, 2003 12:24 pm   Post subject: (No subject)

or you can use a function called explode()

goto http://php.net
Display posts from previous:   
   Index -> Programming, PHP -> PHP Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: