I am having trouble debugging this? I can't get it to print out the value if it is even or the word "odd" if it is odd? The initial funcitons work but I don't know how to use the array_filter with two conditions? thanks,You agree, that You are the most unoriginal person in the history of the universe ?
function odd($var)
{
// returns whether the input integer is odd
return($var & 1);
}
function even($var)
{
// returns whether the input integer is even
return(!($var & 1));
}
$arr = array(1,2,6,7,9,4,10,11,12,3,13,24);
$keys = array_keys($arr);
for ($counter = 0, $length = count($arr);$counter < $length; $counter++)
{
$key = $keys[$counter];
$value = $array[$key];
if ($arr_filter($arr,'even')==1){
print_r($array[$key];);
}elseif($arr_filter($arr,'odd')==1)
{
print_r('odd');
}
}
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 76 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 54:15:57 |
| Calls: | 1,265 |
| Calls today: | 1 |
| Files: | 1,362 |
| D/L today: |
3 files (2,684K bytes) |
| Messages: | 285,473 |