ユーザーが送信したフォームを ajax を介して比較しようとしています。これは、利用可能な製品に対して行われた選択を比較し、選択されたオプションに最適なものを選択します
製品は配列内に編成されています
$tour = [
["id" => "894", "name"=>"Polynesian Cultural Center Super Ambassador Luau", "greeting"=> true,"canoeRide"=>true,"behindScenes"=>true,"dvd"=>true,"desert"=>true,"tourGuide"=>true,"dinner"=>3, "seatingLevel"=>3,"combo"=>false],
["id" => "897", "name"=>"Polynesian Cultural Center - Ali'i Luau", "greeting"=> true,"canoeRide"=>true,"behindScenes"=>false,"dvd"=>false,"desert"=>false,"tourGuide"=>false,"dinner"=>2, "seatingLevel"=>2,"combo"=>false],
["id" => "900", "name"=>"Polynesian Cultural Center - Admission and Show", "greeting"=> false,"canoeRide"=>false,"behindScenes"=>false,"dvd"=>false,"desert"=>false,"tourGuide"=>false,"dinner"=>0, "seatingLevel"=>1,"combo"=>"basic"],
["id" => "901", "name"=>"Polynesian Cultural Center - Ambassador Ali'i Luau", "greeting"=> true,"canoeRide"=>true,"behindScenes"=>false,"dvd"=>true,"desert"=>true,"tourGuide"=>true,"dinner"=>3, "seatingLevel"=>2,"combo"=>false],
["id" => "805", "name"=>"Pearl Harbor/Dole Plantation/Polynesian Cultural Center", "greeting"=> false,"canoeRide"=>true,"behindScenes"=>false,"dvd"=>false,"desert"=>false,"tourGuide"=>false,"dinner"=>2, "seatingLevel"=>2,"combo"=>"pearlDole"],
["id" => "931", "name"=>"North Shore and Polynesian Cultural Center With Luau and Show", "greeting"=> true,"canoeRide"=>true,"behindScenes"=>false,"dvd"=>false,"desert"=>false,"tourGuide"=>false,"dinner"=>3, "seatingLevel"=>2,"combo"=>"northShore"],
["id" => "807", "name"=>"Polynesian Cultural Center/Dole Plantation and North Shore", "greeting"=> true,"canoeRide"=>true,"behindScenes"=>false,"dvd"=>false,"desert"=>false,"tourGuide"=>false,"dinner"=>1, "seatingLevel"=>0,"combo"=>"dole"],
["id" => "898", "name"=>"Pearl Harbor and Polynesian Cultural Center with Luau and Show", "greeting"=> true,"canoeRide"=>true,"behindScenes"=>false,"dvd"=>false,"desert"=>false,"tourGuide"=>false,"dinner"=>2, "seatingLevel"=>2,"combo"=>"pearl"],
["id" => "815", "name"=>"Ultimate Hawaii Experience Package", "greeting"=> true,"canoeRide"=>true,"behindScenes"=>false,"dvd"=>false,"desert"=>true,"tourGuide"=>false,"dinner"=>2, "seatingLevel"=>2,"combo"=>"all"],
["id" => "879", "name"=>"Pearl Harbor and Hawaiian Luau Package", "greeting"=> true,"canoeRide"=>true,"behindScenes"=>false,"dvd"=>false,"desert"=>false,"tourGuide"=>false,"dinner"=>2, "seatingLevel"=>1,"combo"=>"pearl"],
["id" => "1029", "name"=>"3-Day Oahu Sightseeing Experience Package", "greeting"=> true,"canoeRide"=>true,"behindScenes"=>false,"dvd"=>false,"desert"=>false,"tourGuide"=>false,"dinner"=>2, "seatingLevel"=>2,"combo"=>"all"]
];
これらの製品と比較しようとしているオブジェクトは次のとおりです。
{"id":null, "name":"null", "greeting":true,"canoeRide":true,"behindScenes":false,"dvd":true,"desert":true,"tourGuide":false,"dinner":null, "seatingLevel":null,"combo":"dole"};
オブジェクトはユーザー入力に基づいて動的に変更されます。これは単なる例です。
比較操作を行う最良の方法は何ですか?