- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
$vhost ='
<Directory "/srv/httpd/htdocs/mydomain.com">
Options Indexes FollowSymLinks
AllowOverride All
Order deny,allow
Allow from 127.0.0.1
Allow from xxx.xxx.xxx.xxx
Allow from xxx.xxx.xxx.xxx
Deny from all
</Directory>';
$matches = [];
$directory = preg_match('/<Directory "(.*")>([\s\S]*)<\/Directory>/', $vhost, $matches);
var_dump($matches);