note 66954 deleted from function.array-sum by levim

From: Date: Tue, 18 Mar 2014 19:39:59 +0000
Subject: note 66954 deleted from function.array-sum by levim
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-198958@lists.php.net to get a copy of this message
Note Submitter: jodymickey at yahoo dot com ---- In reference to KageKonjou's array_mode function... If you only want to know the value in the array that occurs most (and not the number of times it actually occured), you can use this short function. It also suffers from the same problem in that if there is more than one mode, it will return only one. <?php function array_mode($array) { if(!is_array($array)) return false; asort(array_count_values($array)); return array_pop($array); } ?>

« previous php.notes (#198958) next »