<?php function check($existing, $new) { $existingArray = explode(",", $existing); $newArray = explode(",", $new); if (count($newArray) !== count($existingArray)) return false; foreach ($newArray as $n) { if (!in_array($n, $existingArray)) return false; } return true; } $existingRecords = "1,3,4,6,5"; $newRecords = "6,4,3,1,5"; var_dump(check($existingRecords, $newRecords));
You have javascript disabled. You will not be able to edit any code.