我有下面的代码,其中,我使用一个循环内的循环来创建一个PHP数组:遍历一个PHP数组比遍历MySQLi关联数组更好吗?
$result= mysqli_query($myqueri1);
while($row = mysqli_fetch_assoc($result))
{
$result1=mysqli_query($myqueri2); //This query utilizes a variable obtained from the outer loop. So this cant be written outside the loop.
while($row = mysqli_fetch_assoc($result))
{
//Operations
}
}
两个数组包含几乎50,000列。他们被索引。
但是,我更关心优化问题。如果我将循环1的所有结果存储到一个PHP数组中,然后遍历它,它有什么区别吗?或者正在使用while($row = mysqli_fetch_assoc($result))
与通过常见的PHP循环相同?哪个更优化?