Does PHP have built-in data structures?

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

    Of course PHP has data structures. The array in php is incredibly flexible. Some examples:

    $foo = array(
      'bar' => array(1,'two',3),
      'baz' => explode(" ", "Some nice words")
    );
    

    Then you have an absolute plethora of array functions available to map/filter/walk/etc the structures, or convert, flip, reverse, etc.

提交回复
热议问题