Does PHP have built-in data structures?

后端 未结 14 723
名媛妹妹
名媛妹妹 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:52

    As for today (PHP 7.4), only native structure is an array. But from PHP7 extension DS appeared that includes new data structures and all of them are much faster than other implementations (including SPL recommended in accepted answer).

    DS extension - PHP Manual

    Interfaces: Collection, Hashable, Sequence

    Classes: Vector, Deque, Map, Pair, Set, Stack, Queue, PriorityQueue

    Orginal article about extension

提交回复
热议问题