3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $times = array('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 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined offset: 1 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined offset: 2 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined offset: 3 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined offset: 4 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined offset: 5 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined offset: 6 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined offset: 7 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined offset: 8 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined offset: 9 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined offset: 10 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined offset: 11 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 array(12) { [0]=> array(2) { [0]=> string(5) "Porto" [1]=> string(7) "Benfica" } [1]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Maritimo" } [2]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Sporting" } [3]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(5) "Porto" } [4]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Maritimo" } [5]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Sporting" } [6]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(5) "Porto" } [7]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(7) "Benfica" } [8]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(8) "Sporting" } [9]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(5) "Porto" } [10]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(7) "Benfica" } [11]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(8) "Maritimo" } } PRIMEIRO TURNOarray(12) { [0]=> array(2) { [0]=> string(5) "Porto" [1]=> string(7) "Benfica" } [1]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Maritimo" } [2]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Sporting" } [3]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(5) "Porto" } [4]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Maritimo" } [5]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Sporting" } [6]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(5) "Porto" } [7]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(7) "Benfica" } [8]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(8) "Sporting" } [9]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(5) "Porto" } [10]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(7) "Benfica" } [11]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(8) "Maritimo" } } SEGUNDO TURNO Notice: Undefined variable: segundo_turno in /in/9ooS5 on line 23 NULL
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined index: 1 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined index: 2 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined index: 3 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined index: 4 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined index: 5 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined index: 6 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined index: 7 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 Notice: Undefined index: 8 in /in/9ooS5 on line 13 Warning: array_reverse() expects parameter 1 to be array, null given in /in/9ooS5 on line 13 array(12) { [0]=> array(2) { [0]=> string(5) "Porto" [1]=> string(7) "Benfica" } [1]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Maritimo" } [2]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Sporting" } [3]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(5) "Porto" } [4]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Maritimo" } [5]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Sporting" } [6]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(5) "Porto" } [7]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(7) "Benfica" } [8]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(8) "Sporting" } [9]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(5) "Porto" } [10]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(7) "Benfica" } [11]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(8) "Maritimo" } } PRIMEIRO TURNOarray(12) { [0]=> array(2) { [0]=> string(5) "Porto" [1]=> string(7) "Benfica" } [1]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Maritimo" } [2]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Sporting" } [3]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(5) "Porto" } [4]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Maritimo" } [5]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Sporting" } [6]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(5) "Porto" } [7]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(7) "Benfica" } [8]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(8) "Sporting" } [9]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(5) "Porto" } [10]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(7) "Benfica" } [11]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(8) "Maritimo" } } SEGUNDO TURNONULL
Output for 5.0.4 - 5.2.17
Notice: Undefined offset: 1 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 2 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 3 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 4 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 5 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 6 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 7 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 8 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 9 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 10 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 11 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 array(12) { [0]=> array(2) { [0]=> string(5) "Porto" [1]=> string(7) "Benfica" } [1]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Maritimo" } [2]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Sporting" } [3]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(5) "Porto" } [4]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Maritimo" } [5]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Sporting" } [6]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(5) "Porto" } [7]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(7) "Benfica" } [8]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(8) "Sporting" } [9]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(5) "Porto" } [10]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(7) "Benfica" } [11]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(8) "Maritimo" } } PRIMEIRO TURNOarray(12) { [0]=> array(2) { [0]=> string(5) "Porto" [1]=> string(7) "Benfica" } [1]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Maritimo" } [2]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Sporting" } [3]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(5) "Porto" } [4]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Maritimo" } [5]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Sporting" } [6]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(5) "Porto" } [7]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(7) "Benfica" } [8]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(8) "Sporting" } [9]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(5) "Porto" } [10]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(7) "Benfica" } [11]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(8) "Maritimo" } } SEGUNDO TURNO Notice: Undefined variable: segundo_turno in /in/9ooS5 on line 23 NULL
Output for 4.3.2 - 5.0.3
Notice: Undefined offset: 1 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 2 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 3 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 4 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 5 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 6 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 7 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 8 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 9 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 10 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 11 in /in/9ooS5 on line 13 Warning: array_reverse(): The argument should be an array in /in/9ooS5 on line 13 array(12) { [0]=> array(2) { [0]=> string(5) "Porto" [1]=> string(7) "Benfica" } [1]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Maritimo" } [2]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Sporting" } [3]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(5) "Porto" } [4]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Maritimo" } [5]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Sporting" } [6]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(5) "Porto" } [7]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(7) "Benfica" } [8]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(8) "Sporting" } [9]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(5) "Porto" } [10]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(7) "Benfica" } [11]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(8) "Maritimo" } } PRIMEIRO TURNOarray(12) { [0]=> array(2) { [0]=> string(5) "Porto" [1]=> string(7) "Benfica" } [1]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Maritimo" } [2]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Sporting" } [3]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(5) "Porto" } [4]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Maritimo" } [5]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Sporting" } [6]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(5) "Porto" } [7]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(7) "Benfica" } [8]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(8) "Sporting" } [9]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(5) "Porto" } [10]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(7) "Benfica" } [11]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(8) "Maritimo" } } SEGUNDO TURNO Notice: Undefined variable: segundo_turno in /in/9ooS5 on line 23 NULL
Output for 4.3.0 - 4.3.1
Notice: Undefined offset: 1 in /in/9ooS5 on line 13 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 2 in /in/9ooS5 on line 13 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 3 in /in/9ooS5 on line 13 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 4 in /in/9ooS5 on line 13 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 5 in /in/9ooS5 on line 13 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 6 in /in/9ooS5 on line 13 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 7 in /in/9ooS5 on line 13 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 8 in /in/9ooS5 on line 13 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 9 in /in/9ooS5 on line 13 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 10 in /in/9ooS5 on line 13 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/9ooS5 on line 13 Notice: Undefined offset: 11 in /in/9ooS5 on line 13 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/9ooS5 on line 13 array(12) { [0]=> array(2) { [0]=> string(5) "Porto" [1]=> string(7) "Benfica" } [1]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Maritimo" } [2]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Sporting" } [3]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(5) "Porto" } [4]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Maritimo" } [5]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Sporting" } [6]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(5) "Porto" } [7]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(7) "Benfica" } [8]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(8) "Sporting" } [9]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(5) "Porto" } [10]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(7) "Benfica" } [11]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(8) "Maritimo" } } PRIMEIRO TURNOarray(12) { [0]=> array(2) { [0]=> string(5) "Porto" [1]=> string(7) "Benfica" } [1]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Maritimo" } [2]=> array(2) { [0]=> string(5) "Porto" [1]=> string(8) "Sporting" } [3]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(5) "Porto" } [4]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Maritimo" } [5]=> array(2) { [0]=> string(7) "Benfica" [1]=> string(8) "Sporting" } [6]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(5) "Porto" } [7]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(7) "Benfica" } [8]=> array(2) { [0]=> string(8) "Maritimo" [1]=> string(8) "Sporting" } [9]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(5) "Porto" } [10]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(7) "Benfica" } [11]=> array(2) { [0]=> string(8) "Sporting" [1]=> string(8) "Maritimo" } } SEGUNDO TURNO Notice: Undefined variable: segundo_turno in /in/9ooS5 on line 23 NULL