Keys and values is not match when combine?

I’m installing apriori algorithm. I want to take 1-itemset but when I combine array, the result is not exactly (before and after combine, the result is not match). Here is my code:


<?php
	$transactions = array(
		array('A' => 1, 'B' => 0, 'C' => 1, 'D' => 1, 'E' => 0),
		array('A' => 0, 'B' => 1, 'C' => 1, 'D' => 0, 'E' => 1),
		array('A' => 1, 'B' => 1, 'C' => 1, 'D' => 0, 'E' => 1),
		array('A' => 0, 'B' => 1, 'C' => 0, 'D' => 0, 'E' => 1)
	);
	
	// take keys of $transactions and add into $items
	while(list($key)=each($transactions[1])){
		$items[] = $key;
	}
		
	// count quantity of each item in $items
	for($i=0; $i<count($transactions); $i++){
		for($j=0; $j<count($items); $j++){
			if($transactions[$i][$items[$j]]==1){
				$support[$j]++;
			}
		}
	}
	
	echo 'Before combine:  (I want to the result like this)<br />';
	for($i=0; $i<count($support); $i++){
		echo $support[$i],'-',$items[$i];
		echo '<br />';
	}
	
	$itemset1 = array_combine($items, $support);
	echo '<br />';
	
	echo 'After combine: <br />';	
	while(list($key, $value)=each($itemset1)){
		echo $key,'-',$value;
		echo '<br />';
	}
?>

Before combine (I want to the result like this):
A-2
B-3
C-3
D-1
E-3

After combine:
A-2
B-3
C-1
D-3
E-3

Please help me! Thank a lot!

I have done it. Thank for watching!


	// take keys of $transactions and add into $items 
	while(list($key)=each($transactions[1])){
		$items[] = $key;
	}
		
	// count quantity of each item in $items
	for($i=0; $i<count($transactions); $i++){
		for($j=0; $j<count($items); $j++){
			if($transactions[$i][$items[$j]]==1){
				$support[$items[$j]]++;
			}
		}
	}