3v4l.org

run code in 300+ PHP versions simultaneously
<?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));

preferences:
161.89 ms | 406 KiB | 5 Q