function un_zahl($wert) {
return ($wert % 2 == 1);}
function a_zahl($wert) {
return ($wert % 2 == 0);
}
$array1 = array ("a"=>1,"b"=>2,"c"=>3,"d"=>5);
$array2 = array (1, 2, 3, 4, 5, 6);
$werte1 = array_filter($array1, "un_zahl");
echo "1,3,5 valores:
";
while(list($key, $val) = each($werte1)){
echo $val . "
";
}
echo "2,4,6 valores:
";
$werte2 = array_filter($array2, "a_zahl");
while(list($key, $val) = each($werte2)){
echo $val . "
";
}
?>