trying to transfer one array with a combination of positive and negative numbers to a new array- but only where the elements are positive.
This is what I have so far:
$param = array(2, 3, 4, -2, -3, -5);
function positive_function($arr) {
foreach ($arr as &$value) {
if($value > 0)
return $value;
}
}
$modParam1 = positive_function($param);
var_dump($modParam1);
I think I have something wrong with the foreach statement, any sage advice here?
try:
http://codepad.viper-7.com/eKj7pF