Application =& KernelApplication::Instance();
}
function ExtractByMask($array, $mask, $key_id=1, $ret_mode=1)
{
// echo "extracting from
";
// print_pre($array);
$rets = Array();
foreach ($array as $name => $val)
{
$regs = Array();
// echo "checking $name
";
if (eregi($mask, $name, $regs)) {
// echo "matched
";
// print_pre($regs);
if ($ret_mode == 1) {
$rets[$regs[$key_id]] = $val;
}
else {
array_push($regs, $val);
$a_key = $regs[$key_id];
$i = 0;
while (array_key_exists($a_key, $rets)) {
$a_key.=$i;
$i++;
}
$rets[$a_key] = $regs;
}
}
}
// echo "returning ";
// print_pre($rets);
return $rets;
}
}
?>