PHP变量变量

编程入门 行业动态 更新时间:2024-10-26 08:20:48
本文介绍了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变量变量

本文发布于:2023-10-12 01:17:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1483346.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:变量   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!