-2
if語句我在下面的代碼是給我下面的錯誤:構建比賽現場
Notice: Undefined offset: 1 in C:\xampp\htdocs\Project4\matches-submit.php on line 31
我已經嘗試每一個可能性,我無法找出錯誤。
for ($i=0;$i<$numberofSingles;$i++)
{
$information = explode(",",$matches[$i]); //explode every single at time
if ($gender==$information[1]) { //check for gender,if same bye bye
unset($matches[$i]); //check for gender
}
else if ($information[4]!=$os) { //checks for os type
unset ($matches[$i]);
在約會網站上有一個'undefined offset'有趣的東西:) –
在試圖使用它之前,檢查是否設置了'$ information [1]'。爲此,使用'isset()'。 –
很多在你的代碼中丟失的括號 –