Does PHP have built-in data structures?

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

    PHP has arrays which are actually associative arrays and can also be used as sets. Like many interpreted languages, PHP offers all this under one hood instead of providing different explicit data types.

    E.g.

    $lst = array(1, 2, 3);
    $hsh = array(1 => "This", 2 => "is a", 3 => "test");
    

    /Edit: Also, take a look in the manual.

提交回复
热议问题