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
$teams=[1,2,3];
$randTeams = $teams;
shuffle($randTeams);
shuffle($teams);
$i = 1;
$str='';
foreach ($randTeams as $team) {
foreach ($teams as $t) {
if ($team != $t) {
$str.="$i $team - $t<br>";
$i++;
}
}
}
$arr=explode("<br>",$str);
shuffle($arr);
print_r($arr);