All possible combinations algorithm

Andrew McNabb amcnabb at mcnabbs.org
Tue Jun 14 23:27:39 MDT 2005


On Tue, Jun 14, 2005 at 11:25:52PM -0600, Andrew McNabb wrote:
> I would do this recursively.  My PHP stinks, but something like this:
> 
> function hello($array)
> {
> 	foreach ($array as $i => $value) {
> 		unset ($array[$i]);
> 		print $element . hello($array);
> 		$array[$i] = $value;
> 	}
> }
> 

Sorry, that should be "print $value . hello($array)".

-- 
Andrew McNabb
http://www.mcnabbs.org/andrew/
PGP Fingerprint: 8A17 B57C 6879 1863 DE55  8012 AB4D 6098 8826 6868
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://plug.org/pipermail/plug/attachments/20050614/a728e084/attachment.bin 


More information about the PLUG mailing list