note 53474 deleted from function.max by bjori

From: Date: Mon, 27 Mar 2006 11:38:34 +0000
Subject: note 53474 deleted from function.max by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-106746@lists.php.net to get a copy of this message
Note Submitter: walkingmantis ---- To find the max value of a multidimensional array, use max(max()) Use as many max()'s as there are dimensions 2D array Input: <?php $a1 = range(1,25); $a2 = range(26,50); $a3 = range(51,75); $a4 = range(76,100); $a = array($a1,$a2,$a3,$a4); echo $aMax = max(max($a)); ?> Output: 100 3D array Input: <?php $a1 = range(1,25); $a2 = range(26,50); $a3 = range(51,75); $a4 = range(76,100); $a = array($a1,$a2,$a3,$a4); $aA = array($a,$a); echo $aMax = max(max(max($aA))); ?> Output: 100 etc.

« previous php.notes (#106746) next »