435,346 Members | 2,339 Online
Need help? Post your question and get tips & solutions from a community of 435,346 IT Pros & Developers. It's quick & easy.

# Two functions and one problem

 P: n/a Hi, I've created the following sample php code. Elements
Combinations I'd like to define two simple functions: countcombinations(a,...;b,...) listcombinations(a,...;b,...) The first function "countcombinations(a,...;b,...)" should count how many combinations exist in which "a" and "..." are included and "b" and "..." are not included. Example countcombinations(element1;element2,element3) Result: 2 ("element1 combined with element4" and "element1 combined with element5") The second function "listcombinations(a,...;b,...)" should list the elements combined with "a" and "...", excluding from the list the elements "b" and "...". Example listcombinations(element1;element2,element3) Result: element4, element5 I've some difficult in defining this two functions. Can you help me please? Many thanks. Best, Nico Jul 18 '06 #1
3 Replies

 P: n/a "Nico" Hi, I've created the following sample php code. Elements
Combinations I'd like to define two simple functions: countcombinations(a,...;b,...) listcombinations(a,...;b,...) The first function "countcombinations(a,...;b,...)" should count how many combinations exist in which "a" and "..." are included and "b" and "..." are not included. Example countcombinations(element1;element2,element3) Result: 2 ("element1 combined with element4" and "element1 combined with element5") The second function "listcombinations(a,...;b,...)" should list the elements combined with "a" and "...", excluding from the list the elements "b" and "...". Example listcombinations(element1;element2,element3) Result: element4, element5 I've some difficult in defining this two functions. Can you help me please? Many thanks. Best, Nico I don't know if these ae related to your problem, but: 1 - indices start with zero, not one. 2 - A semicolon ends a sentence so I don't understand your argument list 3 - I cannot follow your naming in "combinations". Is this a school project? Shelly Jul 18 '06 #2

 P: n/a Thanks for the answer. No. This is not a school project. Just a funny hobby. Nico "Sheldon Glickler" "Nico" >Hi,I've created the following sample php code.Elements
CombinationsI'd like to define two simple functions:countcombinations(a,...;b,...)listcombinations(a,...;b,...)The first function "countcombinations(a,...;b,...)" should count how manycombinations exist in which "a" and "..." are included and "b" and "..."are not included.Examplecountcombinations(element1;element2,element3)Result: 2 ("element1 combined with element4" and "element1 combined withelement5")The second function "listcombinations(a,...;b,...)" should list theelementscombined with "a" and "...", excluding from the list the elements "b" and"...".Examplelistcombinations(element1;element2,element3)Result: element4, element5I've some difficult in defining this two functions.Can you help me please?Many thanks.Best,Nico I don't know if these ae related to your problem, but: 1 - indices start with zero, not one. 2 - A semicolon ends a sentence so I don't understand your argument list 3 - I cannot follow your naming in "combinations". Is this a school project? Shelly Jul 18 '06 #3

 P: n/a Nico, This is not a PHP problem. I would pose this question in one of the math or statistical groups. Once you get the pseudo code in place it should be easy to program it in PHP. Nico wrote: Hi, I've created the following sample php code. Elements
Combinations I'd like to define two simple functions: countcombinations(a,...;b,...) listcombinations(a,...;b,...) The first function "countcombinations(a,...;b,...)" should count how many combinations exist in which "a" and "..." are included and "b" and "..." are not included. Example countcombinations(element1;element2,element3) Result: 2 ("element1 combined with element4" and "element1 combined with element5") The second function "listcombinations(a,...;b,...)" should list the elements combined with "a" and "...", excluding from the list the elements "b" and "...". Example listcombinations(element1;element2,element3) Result: element4, element5 I've some difficult in defining this two functions. Can you help me please? Many thanks. Best, Nico Jul 18 '06 #4

### This discussion thread is closed

Replies have been disabled for this discussion.