I have a syntax error on the "for" line. I don't know if I'm mixing up arrays and lists but what I want to do is compare each value of $arr one at a time with the array itself. I want to see if any of the values sums to zero.
$arr= array(1,2,3,4,5,6,7,8,-1,-2);
function oc($arr){
while(list($var, $val)= each($arr)){
for (i=0;i < $arr.length;i++){
if ($val = $arr[$i]){
return $val;
}//end if
}//end for
}//end while
return false;
}//end function