note 21959 deleted from ref.math by dams

From: Date: Sun, 02 Jun 2002 22:14:28 +0000
Subject: note 21959 deleted from ref.math by dams
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-31356@lists.php.net to get a copy of this message
Here's how to compute the least common multiple of an array of integers: function gcd($a,$b) { while($b) { $temp=$a%$b; $a=$b; $b=$temp; } return $a; } function lcm($a, $b) { return $a*$b/gcd($a,$b); } $n=array(3,5,7,9,15); echo array_reduce($n,"lcm"); -- David

« previous php.notes (#31356) next »