Created
October 12, 2023 03:25
-
-
Save 4RSIM3R/98af437e847e5fe575d4d99d64335adb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// hilangkan semua item yang duplikat dalam sebuah array | |
// contoh input : [1, 1, 2, 3, 4, 4, 5] | |
// maka output nya : [1, 2, 3, 4, 5] | |
function removeAllDuplicates($arr) | |
{ | |
return $arr; | |
} | |
$arr = [1, 1, 2, 3, 4, 4, 5]; | |
$result = removeAllDuplicates($arr); | |
echo json_encode($result); // [1, 2, 3, 4, 5] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment