Does PHP have built-in data structures?

后端 未结 14 760
名媛妹妹
名媛妹妹 2021-01-30 00:18

I\'m looking at the PHP Manual, and I\'m not seeing a section on data structures that most languages have, such as lists and sets. Am I just blind or does PHP not have anything

14条回答
  •  无人及你
    2021-01-30 00:35

    Although this question is 8 years old I'm posting an answer because PHP 7 introduces an extension called ds providing specialized data structures as an alternative to the array.

    The ds,

    • uses the Ds\ namespace.
    • has 3 interfaces namely,Collection, Sequence and Hashable
    • has 8 classes namely, Vector, Deque,Queue, PriorityQueue, Map, Set, Stack, and Pair

    For more information checkout the Manual and also This blog post has some awesome information including benchmarks.

提交回复
热议问题