public static function convertStringHeadersToArray($headers)
    {
        $lines = explode("\r\n", $headers);
        $headers = [];
        foreach ($lines as $line) {
            if (strpos($line, ':')) {
                $headerParts = explode(':', $line);
                $headers[$headerParts[0]] = trim(implode(':', array_slice($headerParts, 1)));
            }
        }
        return $headers;
    }
public static function convertStringHeadersToArray($headers)
    {
        $lines = explode("\r\n", $headers);
        $headers = [];
        foreach ($lines as $line) {
            if (strpos($line, ':')) {
                $headerParts = explode(':', $line);
                $headers[$headerParts[0]] = trim(implode(':', array_slice($headerParts, 1)));
            }
        }
        return $headers;
    }
public static function convertStringHeadersToArray ( $ headers ) { $ lines = explode ( "\r\n" , $ headers ) ; $ headers = [ ] ; foreach ( $ lines as $ line ) { if ( strpos ( $ line , ':' ) ) { $ headerParts = explode ( ':' , $ line ) ; $ headers [ $ headerParts [ 0 ] ] = trim ( implode ( ':' , array_slice ( $ headerParts , 1 ) ) ) ; } } return $ headers ; }
Returns an associative array between the headers name and their respective values
@param string $headers
@return string[]
Returns an associative array between the headers name and their respective values