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