=abs($triangle[1]-$triangle[2])) return True; else return False; } $triangles = array( 0 => array(2, 3, 4), 1 => array(5, 9, 11), 2 => array(16, 100, 56), 3 => array(35, 29, 56), 4 => array(161, 10, 96), 5 => array(58, 91, 11), 6 => array(19, 10, 40) ); foreach($triangles as $key => $val) { if(checkTriangle($val)) echo "triangles[$key] is a valid triangle.
\n"; else echo "triangles[$key] is not a valid triangle.
\n"; } ?>