Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Use array_count_values() to count the number of times each value appears in the array.
- Use array_filter() to get the values that occur once in the array.
- And finally use array_keys() to get the value from the array.
- example code in PHP
- <?php
- $marks = [12,13,13,14,12,15,15];
- $result = array_keys(array_filter(array_count_values($marks), function($v)
- {
- return $v == 1;
- } ));
- print_r($result);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement