Jump to content

Recommended Posts

Hi folks and thanks for reading this.

 

I am trying to solve a problem with an array of arrays;

I have a function that calculates the number of combinations that can be created given an array of any length.

the function works as print_r gives me the following output. Array ( [0] => Array ( [0] => 111 ) [1] => Array ( [0] => 201 ) ) Array ( [0] => Array ( [0] => 111 [1] => 201 ) )

 

ideally i would like each iteration of the loop below to create a new array so i need to use variable variables to create a new array based on $count in the for loop.

 

 

$arrayOfBets = array(111, 201,301);
for($count=1;$count<=count($arrayOfBets);$count++)
{
$newArray = comb($arrayOfBets, $count);
// I would like to be able to create $newArraytwo $newArrayThree etc according to the $count variable. if not how do i separate the arrays in to separate arrays;
print_r($newArray);
}

grateful for any help :confused:

 

 

 

 

sorry i cut the wrong code here is what i  do have


//process the number of combinations 
$arrayOfBets = array(111, 201,301);
for($count=1;$count<=count($arrayOfBets);$count++)
{
    $newArray=array();
    while ($numberOfBets=combo($numberOfBets,$count))
    {
        $newArray[]=// lost at this stage;
    }
// I would like to be able to create $newArraytwo $newArrayThree etc according to the $count variable. if not how do i separate the arrays in to separate arrays;
print_r($newArray);
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.