【发布时间】:2020-07-28 07:39:25
【问题描述】:
假设我有 2 个数组 $test24 和 $test48 。 现在如果我收到一个网络表单 POST $type value 24 我需要执行这个
foreach ($test24 as $val)
{
code here
}
如果我收到一个网络表单 POST $type value 48 我需要执行此操作
foreach ($test48 as $val)
{
code here
}
我正在尝试以这种方式在单个 foreach 中聚合/合并上面的代码
foreach ($test$type as $val)
{
code here
}
或者这个
foreach ($test.$type as $val)
{
code here
}
但是这两种解决方案都不起作用,您知道解决方案吗?
【问题讨论】: