
There is this function called array_walk which allows you to apply your own function to each element of the array and return true or false... Now, in this user defined function, it would receive a parameter which would be the value of the current array element, check if it is 4 or 5 and return true if so. However, you might need to write another logic to count the number of 4s returned... On Wed, Jul 27, 2011 at 7:57 PM, julianne anyim <julianneanyim@gmail.com>wrote:
Hello,
i have an example array below:
e.g $myarray=array(1, 3, 4, 4, 2, 4, 6, 6, 5);
i need to count how many values are equal to 4 and how many are greater than 5.. using php.. such that
IF i have at least two values equal to 4 and atleast one value greater than 5, THEN {execute some code}
your help will be appreciated :)
-- Julie
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Regards, Peter Karunyu ------------------- Web Performance Evangelist *Make your website and web app faster.*