Why is it that
echo json_encode(array_unique([1,2,3,4,4]));
Outputs
[1,2,3,4]
And
echo json_encode(array_unique([1,2,3,3,4]));
Outputs
{"0":1,"1":2,"2":3,"4":4}
This has lead to some very odd bugs for me, and I simply cannot understand what's going on here. I just want to remove the duplicates from the array and have it returned as an array.