I've been searching and trying for hours, I want to look for duplicates in my variables which print numbers and then eliminate the duplicates leaving just original numbers.
Here is what I've been trying:
$priceminpps = get_field('price_minpps');
$pricemaxpps = get_field('price_maxpps');
$priceminunit = get_field('price_minunit');
$pricemaxunit = get_field('price_maxunit');
$find_duplicates = array($priceminpps, $pricemaxpps, $priceminunit, $pricemaxunit, );
$result = array_unique($find_duplicates);
print($result);
But it doesn't work, can anyone help?
Double check if array_unique doesn't do what it should.
If it's realy
array_unqiue()
i would generate a new array and push the unique numbers in this new one. You can check if it's already in the new array within_array(number-to-check, $array)
.If
in_array()
doesn't return true, add it to the unique-number-array.Example: