- var_dump: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$str = '<Location "/wtf" "yo" hello>
Allow from all
</Location>';
preg_match_all('/(?:^<([A-Za-z]+))|(?:\s+"[^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\S+)>([\s\S]*?)(?:^\s*<\/[A-Za-z]+>$)/m', $str, $matches);
var_dump($matches);