Php: remove (different cases) duplicates from array -
probably discussed topic, in php did not found answer there simpler way realize in follows:
$a = array("hello","hello","hello","world","world"); $p=array(); foreach( $a $v ){ $p[strtolower($v)] = ""; } print_r($p);
keep 1 single element, in small-case, array
something like:
$p = array_unique(array_map('strtolower', $a));
Comments
Post a Comment