PHP变量变量 [英] PHP variable variables

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

问题描述

我想将n个课程的课程标记存储到n个变量中,例如cw1和cw2等.使用变量变量如何提供cw1,cw2等.

I want to store courseworks marks of n courseworks into n variables, such as cw1 and cw2 etc. Using variable variables how can I come with cw1, cw2 etc.

如何动态创建变量?

推荐答案

使用

PHP中的 array 实际上是有序映射.映射是一种将值与键相关联的类型.该类型已针对多种不同用途进行了优化.它可以被视为数组,列表(向量),哈希表(地图的实现),字典,集合,堆栈,队列,甚至可能更多.由于 array 的值可以是其他

An array in PHP is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array values can be other arrays, trees and multidimensional arrays are also possible...

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

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