php3-list | 199901
Date: 01/23/99
- Next message: Arthur Cronos: "[PHP3] e-commerce via php"
- Previous message: Mark: "Re: [PHP3] querying multiple fields of database"
- In reply to: Colin Viebrock: "Re: [PHP3] How to get all possible permutations from an array in"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Colin Viebrock skrev:
> function showCombinations($array) {
> $num = count($array);
> for ($i=1; $i<pow(2,$num); $i++) {
> for ($j=0; $j<$num; $j++) {
> if ( pow(2,$j) & $i ) {
> echo $array[$j] . "\t";
> }
> }
> echo "\n";
> }
> }
>
> $array = array("apples","bananas","cantaloupe","dates");
> showCombinations($array);
Wow! That's so cool! Thank's a million.
Regards,
Erik Tjernlund
Stockholm
-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev-list-admin <email protected>
- Next message: Arthur Cronos: "[PHP3] e-commerce via php"
- Previous message: Mark: "Re: [PHP3] querying multiple fields of database"
- In reply to: Colin Viebrock: "Re: [PHP3] How to get all possible permutations from an array in"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

