Last active
December 14, 2018 18:00
-
-
Save iprodev/0a7b8d7f39defdb19a2aa1ddb3cec894 to your computer and use it in GitHub Desktop.
PHP : Check if array has duplicate values
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 | |
/** | |
* Check if array has duplicate values | |
* | |
* @param array $array Specific array to check | |
* @return boolean | |
*/ | |
function array_has_duplicate( $array ) { | |
return count( $array ) !== count( array_keys( array_flip( $array ) ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment