I can't unset element in array

I have a code as below and I can’t remove element for each loop. Do you know why?

	$data = array(
		array('A', 'C'),
		array('B', 'C', 'E'),
		array('A', 'B', 'C', 'E'),
		array('B', 'E')
	$fi = array( 'C' => 3, 'B' => 3, 'E' => 3, 'A' => 2);
	$tmp = array();
	$mfi = array();
		for($row=0; $row<count($data); $row++){
			$tmp = $fi;
			// each loop, remove element not in $data[$row]
			// and put $tmp into $mfi
			foreach($fi as $key=>&$value){
				if(!in_array($tmp[$key], $data[$row])) unset($tmp[$key]);
			array_push($mfi, $tmp);

Your code is a bit confusing, but it looks like your array $fi has the letters as keys and numbers as values. So when you check if the value is in $data, since the arrays in $data have no numbers, it will never remove anything.

You could always use $key, instead of $tmp[$key].

So, how can I rewrite it?

I told you in my post. I believe yu should be able to use $key instead of $tmp[$key] to check if it is in the array.

Oh! So sorry. Thank a lot!