$lines = explode("\n",$phpinfo);
- $section = 'Root';
+ $section = '';
+ $sub = '';
$rows = [];
while (true) {
$line = next($lines);
if ($line === false) break;
+ // Section
if (strpos($line, '_______') === 1) {
#bye($line);
$section = '';
continue;
}
+ // Sub
+ if (substr(trim($line), -1) !== ',' and !strpos($line, '=>')) {
+ $sub = $line;
+ continue;
+ }
+
+ // Key => Val
if (preg_match('/(.*) => (.*)/',$line,$m)) {
$rows[] = [
'section' => $section,
+ 'sub' => $sub,
'key' => $m[1],
'val' => $m[2],
];
}
- #substr(trim($line_buffer), -1) === ','
+ // Vals multi lines
+ while (substr(trim($line), -1) === ',') {
+ $line = next($lines);
+ if ($line === false) break;
+ #bye($line);
+ #$row = end($rows);
+ $idx = key($rows);
+ $rows[$idx]['val'] .= ' '.$line;
+ }
}
$this->page($rows);