note 87547 deleted from function.max by thiago

From: Date: Tue, 29 Dec 2009 17:00:08 +0000
Subject: note 87547 deleted from function.max by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-164441@lists.php.net to get a copy of this message
Note Submitter: sumeruter+php add an at gmail dot com ---- An interesting feature not mentioned is that if a recursive array is passed to max, max will return the sub-array containing the highest value. Example: <?php $depth3=array( array(array(1,6,3),array(7,2,5),array(9,3,0)), array(array(2,1,8),array(4,4,5),array( 99 ,6,7)), array(array(0,3,2),array(5,91,11),array(42,25,12))); $depth2=max($depth3); // = array(array(2,1,8),array(4,4,5),array( 99 ,6,7)) $depth1=max($depth2); // = array( 99 ,6,7) $depth0=max($depth1); // = 99 echo max(max(max($depth3))); // echo 99; ?>

« previous php.notes (#164441) next »