function jakastam( $data )
{
// Cleanup
$data = str_replace( array( "\n\r", "\r\n", "\r" ), "\n", $data );
// Header i content
if( ( $position = strpos( $data, "\n\n" ) ) !== false )
{
// Header
$header = array();
if( $length = preg_match_all( '/([a-z0-9\-]+):(.*)/i', substr( $data, 0, $position ), $match ) )
{
for( $i = 0; $i < $length; $i++ )
$header[strtolower( $match[1][$i] )] = trim( $match[2][$i], ' ' );
}
// Content
$content = str_replace( "\n", '<br />', substr( $data, $position + 2 ) );
return array( $header, $content );
}
return false;
}