array unique 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 ) $counts = array_count_values($array);
$duplicate_title = array_filter($array, function ($value) use ($counts) {
return $counts[$value] > 1;
});<?php
$input = array("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique($input);
print_r($result);
?>
Array
(
[a] => green
[0] => red
[1] => blue
)$input = array_map("unserialize", array_unique(array_map("serialize", $input)));
Also in PHP:
- Allowed memory size of 1610612736 bytes exhausted for laravel
- date('d/m/Y H:i:s') now
- check if string contains specific word
- composer check php version
- branch from other branch
- PHP Startup: Unable to load dynamic library 'curl'
- debug logging php
- ajout d'heure à une date php
- Token capabilities in vault
- convert html code php
- disable updated_at laravel
- disadvantages of php
- Laravel catch TokenMismatchException
- apt install php7.4-mbstring php7.4-zip php7.4-xml
- encode decode in php
- codeigniter where order by
- exception handling class php
- .htaccess codeigniter
- acheck key exist in array php
- add day for date php
- file_get_contents php ssl
- error_reporting all
- codeigniter remote queries very slow
- creat new folder with php