How can I delete duplicates in array?
For example if I had the following array:
$array = array(\'1\',\'1\',\'2\',\'3\');
I want it
You can filter them out using array_count_values():
$array = array('1','1','2','3');
$res = array_keys(array_filter(array_count_values($array), function($freq) {
return $freq == 1;
}));
The function returns an array comprising the original values and their respective frequencies; you then pick only the single frequencies. The end result is obtained by retrieving the keys.
Demo