Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Searching for text in text file

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Searching for text in text file

Postby ylkien » Sat Sep 06, 2003 8:30 am


i looked through the functions list, but i could find any function that could search something (like a phrase) in a text file. The closes i could get is fseek(), which isn't what i want. Could there be a function like "fsearch"?

New php-forum User
New php-forum User
Posts: 28
Joined: Sat Dec 14, 2002 9:43 am

Postby Oleg Butuzov » Sat Sep 06, 2003 9:13 am

there are no such function....

try to use regular expresions for searching string in text file...
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Redcircle » Sat Sep 06, 2003 10:44 am

you would need to read the file into php and use preg_match.
User avatar
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby swirlee » Sat Sep 06, 2003 11:30 pm

Redcircle wrote:you would need to read the file into php and use preg_match.

Or just strpos() for simple matching.
User avatar
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back


Postby ruturajv » Sun Sep 07, 2003 9:50 pm

use the file function get the text in the array and then use array functions to search the text :idea:
User avatar
php-forum Super User
php-forum Super User
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.