3v4l.org

run code in 300+ PHP versions simultaneously
<?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])); }
Output for 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.28, 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
Array ( [Name] => Value [expires] => Tue, 01 Jan 2018 00:00:00 GMT [domain] => .site.com [path] => / [httponly] => )