function parseFDF($file) { $pattern = "/\/T\s\(([^)]*)\)[\n]\/V\s\(([^)]*)\)/ism"; if (preg_match_all($pattern, $file, $out, PREG_SET_ORDER, 0)) { for ($i=0; $i<count($out); $i++) { if (preg_match($pattern, $out[$i][0], $regs)) { $key = $regs[1]; $val = $regs[2]; $key = preg_replace("/^\s*\(/","",$key); $key = preg_replace("/\)$/","",$key); $key = preg_replace("/\\\/","",$key); $val = preg_replace("/^\s*\(/","",$val); $val = preg_replace("/\)$/","",$val); $matches[$key] = $val; } } return $matches; }}$fdfFile = file_get_contents('testfdf.fdf');var_dump(parseFDF($fdfFile));