- var_dump: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$str = 'CustomLog logs/access_log "%h %l %u %t \"%r\" %>s %b" \'lol wtf\'';
preg_match_all('/"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|\S+/', $str, $matches);
var_dump($matches);