3v4l.org

run code in 300+ PHP versions simultaneously
<?php $times = ['Porto', 'Benfica', 'Maritimo', 'Sporting']; foreach($times as $m => $mandante) { foreach($times as $v => $visitante) { if ($times[$m] != $times[$v]) { $partidas[] = array($times[$m], $times[$v]); } } } $primeiro_turno = null; foreach ($partidas as $p => $partida) { if ($primeiro_turno == null || array_reverse($primeiro_turno[$p]) != $partida) { $primeiro_turno[] = $partida; } else { $segundo_turno[] = $partida; } } print var_dump($partidas); print 'PRIMEIRO TURNO'; print var_dump($primeiro_turno); print 'SEGUNDO TURNO'; print var_dump($segundo_turno);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key 1 in /in/uN6pf on line 13 Fatal error: Uncaught TypeError: array_reverse(): Argument #1 ($array) must be of type array, null given in /in/uN6pf:13 Stack trace: #0 /in/uN6pf(13): array_reverse(NULL) #1 {main} thrown in /in/uN6pf on line 13
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
35.81 ms | 401 KiB | 8 Q