PHP 有 Set 数据结构吗? [英] Does PHP have a Set data structure?

查看:62
本文介绍了PHP 有 Set 数据结构吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 PHP 新手,我无法弄清楚这个基本问题.PHP 是否有某种集合或列表对象?类似于数组的东西,但能够动态地添加或删除任意数量的对象.

解决方案

是的,您可以使用 array 对象和 array 函数.>

基本上,您可以使用 array_push 函数,或 $arrayName[] = ... 符号(其中 arrayName 是数组的名称).

I'm new to PHP, and I can't figure out this basic question. Does PHP have some sort of set or list object? Something like an array, but with the ability to dynamically add or remove any number of objects from it.

解决方案

Yes, you could use the array object and the array functions.

Basically, you could dynamically grow an array using the array_push function, or the $arrayName[] = ... notation (where arrayName is the name of your array).

这篇关于PHP 有 Set 数据结构吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆