3 ms·
I've found one use-case for mixed-keys: parsing complex headers. For example: Link: <http://cdn.example.com/stylesheet.css>; rel=stylesheet; type=text/css
by RossM 12y ago
I've found one use-case for mixed-keys: parsing complex headers. For example:
Link: <http://cdn.example.com/stylesheet.css>; rel=stylesheet; type=text/css
[
[0] => <http://cdn.example.com/stylesheet.css>
[rel] => stylesheet
[type] => text/css
]
It doesn't come up very often.
- Zancarius 12y agoThis actually reminds me of what you get if you use named capture groups in PHP: php > $link = 'http://example.com/'; php > preg_match('#http://(?P<domain>[^/]+)/#', $link, $matches); php > print_r($matches); Array ( [0] => http://example.com/ [domain] => example.com [1] => example.com ) There's some utility to it, but it can provide unexpected results if you blindly iterating through the match array (though I can't see any reason to do so if you know what offsets you want).