Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
Привет,
подскажите пожалуйста в чем причина? Код:
for ($i = 0; $i < count($games); $i++) {
$index = mt_rand(0, count($dates) - 1);
$date = $dates[$index];
$matches[] = new Matches($date, $games[$i], $stadiums[mt_rand(0, 3)]);
unset($dates[$index]);
}
$dates это массив с датами. При удалении элемента через unset($dates[$index]) выдает ошибку Undefined array key на сточку $date = $dates[$index], хотя unset после выполняется.