我正在通过多维数组运行循环,如下所示:
$runcount = 0;
while ($runcount <= 90){
if ($RankingsArray[0][$runcount] == "Rank" or
$RankingsArray[0][$runcount] == "Positional" or
$RankingsArray[0][$runcount] == "Adjusted" or
$RankingsArray[0][$runcount] == "Name" or
$RankingsArray[0][$runcount] == "Team" or
$RankingsArray[0][$runcount] == "Bye" or
$RankingsArray[0][$runcount] == "ADP" or
$RankingsArray[0][$runcount] == "ADP Diff" or
$RankingsArray[0][$runcount] == "ADV" or
$RankingsArray[0][$runcount] == "ADV Diff" or
$RankingsArray[0][$runcount] == "Games" or
$RankingsArray[0][$runcount] == "Points" or
$RankingsArray[0][$runcount] == "Average" or
$RankingsArray[0][$runcount] == "Floor" or
$RankingsArray[0][$runcount] == "Ceiling"){
$run{$runcount} == "yes";
$runcount = $runcount + 1;
}
}
我想要做的是将$ run0变量设置为&#34; yes&#34;如果它满足任何这些条件。然后将$ run1变量设置为&#34; yes&#34;如果它满足任何这些条件。然后设置$ run2变量等等。
我可以像这样引用和设置变量吗?如果是这样,$run{$runcount} == "yes";
无效的正确语法是什么
答案 0 :(得分:1)
我认为正确的方法是
${'run'.$runcount} = "yes";