<?php
$data = ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth'];
$chose = [];
$result = [];
foreach($data as $i=>$item)
{
$pair = array_rand(array_diff_key($data, $chose, [$i]);
$chose[] = $pair;
$result[]= [$item, $data[$pair]];
var_dump($chose);
}
//var_dump($result);
- Output for 5.4.0 - 5.4.23
- Parse error: syntax error, unexpected ';' in /in/uAgEm on line 8
Process exited with code 255. - Output for 5.3.0 - 5.3.28
- Parse error: syntax error, unexpected '[' in /in/uAgEm on line 3
Process exited with code 255.
preferences:
187.33 ms | 1395 KiB | 60 Q