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