Built in support for sets in PHP?

后端 未结 5 1039
一生所求
一生所求 2020-12-05 16:45

I\'m looking for a simple way to create an array in php that will not allow duplicate entries, but allows for easy combining of other sets or arrays.

I\'m mostly int

5条回答
  •  无人及你
    2020-12-05 17:23

    You can use array_combine for removing duplicates

    $cars = array("Volvo", "BMW", "Toyota");
    array_push($cars,"BMW");
    
    $map = array_combine($cars, $cars);
    

提交回复
热议问题