我习惯了
Java,我有HashSets,ArrayLists和其他Collections.但是我现在正在处理一个
PHP项目.
我需要创建一个集合,用对象填充该集合(在这种情况下为Strings),但是Set只能包含每个对象一次.此外,如果存在,我想从此集合中删除最终的某个对象.这将很容易与Java集合类.但是如何在PHP中实现呢?
PHP文档说:
原文链接:https://www.f2er.com/php/139497.htmlAn array in PHP is actually an ordered map. A map is a type that
associates values to keys. This type is optimized for several
different uses; it can be treated as an array,list (vector),hash
table (an implementation of a map),dictionary,collection,stack,
queue,and probably more. As array values can be other arrays,trees
and multidimensional arrays are also possible.
所以maybee(!)你不需要一个HashSet,因为正常的数组已经被实现为一种优化的索引结构:)