使用while语句循环数组节点,获取行值,并在PHP中的下一个循环之前保存这些值
在再次循环之前,是否可以创建一个函数来保存此循环中的值?现在,每次都会覆盖这些值。我是新的php,所以如果你有任何网站,你想把我链接到,这也是很好的使用while语句循环数组节点,获取行值,并在PHP中的下一个循环之前保存这些值,php,Php,在再次循环之前,是否可以创建一个函数来保存此循环中的值?现在,每次都会覆盖这些值。我是新的php,所以如果你有任何网站,你想把我链接到,这也是很好的 //loop through array node and get row values while ($i < $arrlength ) { // get row value $value = $array['Children']['1']['Properties'][$i]['Value']."\
//loop through array node and get row values
while ($i < $arrlength ) {
// get row value
$value = $array['Children']['1']['Properties'][$i]['Value']."\n";
// convert delimited string to an array
$arrayPieces = explode("|", $value);
$rowName = $arrayPieces[0];
$charactersName = $arrayPieces[1];
$highscoreFeet = $arrayPieces[2];
$charactersFitnessLevel = $arrayPieces[3];
$worstJump = $arrayPieces[4];
$totalTrainingTime = $arrayPieces[5];
$startingDate = $arrayPieces[6];
$i++;
}
我不明白你的最终目标是什么,但这会拯救他们
$i=0;
//loop through array node and get row values
while ($i < $arrlength ) {
// get row value
$value = $array['Children']['1']['Properties'][$i]['Value']."\n";
// convert delimited string to an array
$arrayPieces = explode("|", $value);
$rowName[$i][0] = $arrayPieces[0];
$charactersName[$i][1] = $arrayPieces[1];
$highscoreFeet[$i][2] = $arrayPieces[2];
$charactersFitnessLevel[$i][3] = $arrayPieces[3];
$worstJump[$i][4] = $arrayPieces[4];
$totalTrainingTime[$i][5] = $arrayPieces[5];
$startingDate[$i][6] = $arrayPieces[6];
$i++;
}
编辑:我修正了我的第一个疯狂答案。您想将值保存在哪里?就在while循环里做?!需要更多关于最终目标的信息。