Click here to Skip to main content
15,946,988 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
PHP
$critics = array('Lisa Rose' => array('Lady in the Water' => 2.5, 'Snakes on a Plane' => 3.5, 'Just My Luck' => 3.0),
	'Gene Seymour' => array('Lady in the Water' => 3.0, 'Snakes on a Plane' => 3.5, 'Just My Luck' => 1.5));

$list = array();
function test($prefs, $p1, $p2) {
	global $list;
	foreach(array_keys($prefs) as $item)
		if($item != $p1)
			foreach(array_keys($prefs[$item]) as $preferences)
				if (array_keys($prefs[$p1] == $preferences)
					array_push($list, $preferences);
}
#Find the number of elements
$count = count($list);
print_r (array_keys($critics));
test($critics, 'Lisa Rose', 'Gene Seymour');
Posted
Updated 9-Sep-15 23:28pm
v2

1 solution

Quote:
if (array_keys($prefs[$p1] == $preferences)

There's a missing closing round brace in the above line.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900