Moving text data into variables

From: Date: Sat, 03 May 2003 20:34:32 +0000
Subject: Moving text data into variables
Groups: php.general 
Request: Send a blank email to php-general+get-146303@lists.php.net to get a copy of this message
Could somebody tell me way this stops at Corp Type: and how I can make it process the whole file. I can not change the format of the text string in any way but I need to move the data into variables. $f = "Name: WILL PROVIDE, INC. Type: CorporationFile Number:C17481-2221State: NEVADA Incorporated On: July 02, 2001Status: Current list of officers on fileCorp Type: Non-profitResident Agent: AMERICAN LEGAL SERVICES (Accepted)Address: 239 S. SIERRA STREET RENO NV89501- President:ROBERT DOBYNS Address: 16843 FM 1314 CONROE TX77302- Secretary:RICK PENNY Address: 23026 RED LEO SPRING TX77389- Treasurer:DEBORAH PENNY Address: 23026 RED LEO SPRING TX77389-"; $p = array(); $f = explode('Name:', $f); $f = $f[1]; $v = explode('Type:', $f); $p['NAME'] = trim(array_shift($v)); $f = array_shift($v); $v = explode('File Number:', $f); $p['TYPE'] = trim(array_shift($v)); $f = array_shift($v); $v = explode('State:', $f); $p['FILENUMBER'] = trim(array_shift($v)); $f = array_shift($v); $v = explode('Incorporated On:', $f); $p['STATE'] = trim(array_shift($v)); $f = array_shift($v); $v = explode('Status:', $f); $p['INCORPORATEDON'] = trim(array_shift($v)); $f = array_shift($v); $v = explode('Corp Type:', $f); $p['STATUS'] = trim(array_shift($v)); $f = array_shift($v); $v = explode('Resident Agent:', $f); $p['CORPTYPE'] = trim(array_shift($v)); $f = array_shift($v); $v = explode('Address:', $f); $p['RESIDENTAGENT'] = trim(array_shift($v)); $f = array_shift($v); $v = explode('President:', $f); $p['ADDRESS'] = trim(array_shift($v)); $f = array_shift($v); $v = explode('Address:', $f); $p['PRESIDENT'] = trim(array_shift($v)); $f = array_shift($v); $v = explode('Secretary:', $f); $p['ADDRESSP'] = trim(array_shift($v)); $f = array_shift($v); $v = explode('Address:', $f); $p['SECRETARY'] = trim(array_shift($v)); $f = array_shift($v); $v = explode('Treasurer:', $f); $p['ADDRESSS'] = trim(array_shift($v)); $f = array_shift($v); $v = explode('Address:', $f); $p['TREASURER'] = trim(array_shift($v)); $f = array_shift($v); $p['ADDRESST'] = trim(array_shift($v)); $f = array_shift($v); print_r($p); -- Best regards, Richard mailto:rdkurth@starband.net

« previous php.general (#146303) next »