check if array is duplicate and get the latest values php
<?php
$fruits_list = array('Orange', 'Apple', ' Banana', 'Cherry', ' Banana');
$result = array_unique($fruits_list);
print_r($result);
?>
Output:
Array ( [0] => Orange [1] => Apple [2] => Banana [3] => Cherry ) function has_dupes($array) {
$dupe_array = array();
foreach ($array as $val) {
if (++$dupe_array[$val] > 1) {
return true;
}
}
return false;
}
Also in PHP:
- date time function to php date
- change php version ubuntu
- error e all php
- cronjob cakephp
- clear cache php artisan
- How to handle max time of execution
- clear cache manually laravel
- How do I clear laravel cache online?
- add one day to given date in php
- cacert file_get_contents openssl
- clear catche laravel
- composer install laravel 7 not installing
- collection empty laravel
- activity log spatie
- find string pos
- filter array in php with passing extra params
- Allowed memory size of 2147483648 bytes exhausted composer install
- clear laravel.log
- explain email injection
- check if contain keyword php
- PHP Startup: Unable to load dynamic library 'curl'
- convert text to uppercase in php
- array key contains php
- add days with dates php