Not sure if thats what you were looking for, try this:
Code:
$str = <<<EOD
---
FieldType: Text
FieldName: user_email
FieldFlags: 12582912
FieldJustification: Right
---
FieldType: Text
FieldName: user_phone
FieldFlags: 12582912
FieldJustification: Right
---
FieldType: Text
FieldName: user_url
FieldFlags: 12582912
FieldJustification: Right
EOD;
$arrFields = preg_split("/---/", $str);
$aResult = array();
for($i=0; $i<count($arrFields); $i+=1){
$Val = $arrFields[$i];
if(!empty($Val)){
$arr = explode("\n", $Val);
foreach($arr as $line){
if(!empty($line)){
$aLine = explode(":", $line);
if(array_key_exists('1', $aLine)){
echo __LINE__.' aLine: '.print_r($aLine, true)."\n";
$arr[] = $aLine[1];
}
$aResult[$i][] = $arr;
}
}
}
}
print_r($aResult);
Bookmarks