private static function _analyze($deep, $array, $tree)
{
//echo $deep;
$val = $array[$deep];
foreach ($tree as $key => $child) {
if ($key == "__callback") {
continue;
}
$str = preg_quote($key);
if ($key === "" && $val !== "") {
continue;
}
$str = str_replace('\\*', '.*?', $str);
$str = str_replace('\\?', '.', $str);
$str = "/" . $str . "/";
// Build RegExp for test
if (self::$debug) {
echo "deep = " . $deep . ", RegEx = " . $str . ", Value = " . $val . ", Result = " . (preg_match($str, $val) ? "True" : "False") . "\n";
}
if (preg_match($str, $val)) {
if ($deep == count($array) - 1 || count($child) == 1) {
self::callBack($tree[$key]);
//return true;
}
if (count($array) > $deep + 1) {
if (!self::_analyze($deep + 1, $array, $child)) {
continue;
}
} else {
continue;
}
} else {
continue;
}
}
return false;
}