/** * Parses result of preg_match_all * * @return array */ public function getPmaMatches() { $result['count'] = $this->pmaCount; $result['expr'] = Formatter::arrayToTree($this->pmaMatches[0]); $result['mtch'] = Formatter::arrayToTree($this->pmaMatches[1]); return $result; }
/** * Convert and array to a string representation in tree format * * @param string $array * @return string */ public static function arrayToTree($array) { $tree = ""; foreach ($array as $key => $item) { if (is_array($item)) { $item = Formatter::arrayToTree($item); } $tree .= "[" . $key . "] " . self::sanitize($item) . PHP_EOL; } return $tree; }