Why not use RegEx? I'm doing a similar search with RegEx. Makes the code much shorter.
Anders Nawroth www.nawroth.com ----- Ursprungligt meddelande ----- Från: "Jack Dempsey" <[EMAIL PROTECTED]> Till: <[EMAIL PROTECTED]>; "Nick Richardson" <[EMAIL PROTECTED]> Skickat: den 23 oktober 2001 07:20 Ämne: RE: [PHP] Matching strings in a flat/text file? lots of ideas nick, but can you use a database? MySQL is free and i've found its almost always better to use databases when you can... if you can't, you could do something like this: 1. find the pos of the string you need using strpos 2. find the pos of the ending delimiter 3. substr from the first pos to the end (you'll need to add/subtract some strlen's to slice off the delimiters as well... jack -----Original Message----- From: Nick Richardson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 23, 2001 1:10 AM To: [EMAIL PROTECTED] Subject: [PHP] Matching strings in a flat/text file? Hey everyone, Anyone out there know how i could do this: I have a client who is an import car tuner. They would like to feature the cars they work on in their website. Instead of creating a new .html or .php file for every car they add to include the background setup, and the general content (type of car, owner, etc...) i want to put the information in to text file and search for it in there. So that's where i need help. I want to be able to put the info into a text file and pass the string to search for through the URL, then match everything between that line and an ending line in the text file, and print that out to the browser. Example: I want to pass a string using the URL (blah.php?car=civic_si) then search for ##civic_si in the text file, and print everything until it finds ##end. So the text file will look like this: ##civic_si This is my content, blah blah ##end ##nissan This is more content... yadda yadda ##end Any ideas on how i can do this??? //Nick Richardson [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]