Forum Moderators: coopster
i have a php code that opens a text file and makes some changes to it. but i only want the code to execute if the following word is found somewhere in the file: "xq33XSDs"
can anyone tell me how i can do this.
thanx
Doesn't really seem like a great solution here.
options I can think of off the top of my head
1. use file [ca2.php.net] and then do a if(!in_array [ca2.php.net]()) but if the file is huge then you are loading the whole thing into memory
2. use fgets [ca2.php.net] to read through line by line and use preg_match [ca2.php.net] or some similar string matching function to check each line for the string
3. use exec [ca2.php.net] or passthru [ca2.php.net] to run a command line grep, though this may be a bit of a pain to get going