Reply
How to check if string exists in text file with php
Old 03-16-2006, 05:19 AM How to check if string exists in text file with php
stOx's Avatar
Machine

Latest Blog Post:
Worlds Smallest Car - Peel P50
Posts: 2,114
Name: Matt. (>',')>
Location: London, England.
Hi..

I have a text file that contains lots of entries.
Does anyone know how i can check to see if a string exists in that text file with php?

It's basically a search involving the contents of a text file.
stOx is offline
Reply With Quote
View Public Profile Visit stOx's homepage!
 
When You Register, These Ads Go Away!
     
Old 03-16-2006, 08:03 AM Re: How to check if string exists in text file with php
Novice Talker

Posts: 10
You could do:

PHP Code:
<?
$file 
file_get_contents("filename.ext");
if(!
strpos($file"search string")) {
echo 
"String not found!";
}
?>
__________________
Magento Optimized Web Hosting
Premium hosting services for the Magento eCommerce platform.
Professional Magento Installation included with every plan.
Sindre is offline
Reply With Quote
View Public Profile Visit Sindre's homepage!
 
Old 03-16-2006, 08:14 AM Re: How to check if string exists in text file with php
stOx's Avatar
Machine

Latest Blog Post:
Worlds Smallest Car - Peel P50
Posts: 2,114
Name: Matt. (>',')>
Location: London, England.
That worked perfect, Thanks sindre!
stOx is offline
Reply With Quote
View Public Profile Visit stOx's homepage!
 
Reply     « Reply to How to check if string exists in text file with php
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12417 seconds with 13 queries