'', 'version' => '', 'desc' => '', 'author' => '', 'depends' => ''); $spl = split("\n", $contents); $currAttr = null; $currData = null; foreach ($spl as $l) { if ( substr($l, 0, 6) == 'TITLE:' ) { if ( $currAttr ) { $infos[$currAttr] = ltrim($currData); } $currAttr = "title"; $currData = substr($l, 6); } else if ( substr($l, 0, 12) == 'DESCRIPTION:' ) { if ( $currAttr ) { $infos[$currAttr] = ltrim($currData); } $currAttr = "desc"; $currData = substr($l, 12); } else if ( substr($l, 0, 8) == 'VERSION:' ) { if ( $currAttr ) { $infos[$currAttr] = ltrim($currData); } $currAttr = "version"; $currData = substr($l, 8); } else if ( substr($l, 0, 8) == 'DEPENDS:' ) { if ( $currAttr ) { $infos[$currAttr] = ltrim($currData); } $currAttr = "depends"; $currData = substr($l, 8); } else if ( substr($l, 0, 7) == 'AUTHOR:' ) { if ( $currAttr ) { $infos[$currAttr] = ltrim($currData); } $currAttr = "author"; $currData = substr($l, 7); } else { $currData .= $l; } } $infos[$currAttr] = ltrim($currData); return $infos; } ?>