Re: finding a substring
| From: | Jason Barnett | Date: | Sat, 17 Jul 2004 05:19:52 +0000 |
| Subject: | Re: finding a substring | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-190811@lists.php.net to get a copy of this message | ||
C.F. Scheidecker Antunes wrote:
Hello all, I need to read lines within a text file that might have a " value='somevalue' " string the position of "value=" varies from line to line but there's only one "value=" in each line. So what I need to do is to parse the file and find the "value=" and put their values in an array.http://www.php.net/parse_ini_file Not sure if this is what you're doing exactly, but if this is a settings / ini file you're creating then you can also use parse_ini_file. It'll allow you to create files like the php.ini and parse the values, in your case: -----------test.ini---------- ; I am a comment to tell you what snLADEFEFfdgvalue means snLADEFEFfdgvalue="1234"rwgjngrgj value="23456"gkerlgwg 132fngdhbvalue="5678"bfl928 -----------test.php---------- <?php $settings = parse_ini_file('test.ini'); ?>