- array_combine: documentation ( source)
- print_r: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$s = "Set-Cookie: Name=Value; expires=Tue, 01 Jan 2018 00:00:00 GMT; domain=.site.com; path=/; httponly";
if (preg_match_all('~(?:\G(?!^);|Set-Cookie:)\s*\K([^=\n]+)(?:=([^;\n]+))?~', $s, $matches)) {
print_r(array_combine($matches[1],$matches[2]));
}