Matchlist
Posted: Fri Jan 26, 2007 2:03 pm
I'm trying to create an array of numbers derived from a larger set of numbers.
For example I have a list like
I want to take one of each number and input into an array so my new array would be
I essentially want one copy of each number in the list. Order does not matter.
Here is my attempt
Is there any easier way? Say for example I could see if a number is in a matchlist delimited by commas and add it to the list if it was not in there and refuse to add it if it is already in the list?
For example I have a list like
Code: Select all
1,3,4,2,5,1,4,1,2,3,1,3Code: Select all
1,3,4,2,5Here is my attempt
Code: Select all
$mindex = 0; $matchCont = true;
while($matchCont)
{
if ($allCounts[$mindex] = $guiCount[0])
$match = true;
if ($mindex >= sizeof($allCounts) - 1)
$matchCont = false;
echo $guiCount[0] . " - " . $mindex . "<br>";
$mindex++;
}
if (!$match)
$allCounts[sizeof($allCounts)] = $guiCount[0];