I originally have an array that reads
$array1 = array("a","a","b","b")
I run it through ‘array_unique’, but I want it to only have two elements. Basically, I want to eliminate empty elements and reduce the keys, i.e.
[0]=>string(1) "a"
and
[1]=>string(1) "b"
I’m stuck. How would I go about doing that?
array_unique()is what you would use, as you mentioned.If you want the keys to be reset, use
array_values().CodePad.