3v4l.org

run code in 300+ PHP versions simultaneously
<?php function printTable($matrix) { $table = '<table border="1">'; $rows = count($matrix); for ($i = 0; $i < $rows; $i++) { $cols = count($matrix[$i]); $table .= '<tr>'; for ($j = 0; $j < $cols; $j++) { $table .= '<td>' . $matrix[$i][$j] . '</td>'; } $table .= '</tr>'; } $table .= '</table>'; echo $table; } function createMatrix($x, $y) { $matrix = []; for ($i = 0; $i < $x; $i++) { $row = []; for ($j = 0; $j < $y; $j++) { $row[] = rand(1, 100); } $matrix[] = $row; } return $matrix; } function transposeArray($array) { $i = 0; $transpose = []; while ($columns = array_column($array, $i++)) { $transpose[] = $columns; } return $transpose; } $table = createMatrix(10, 5); echo 'Matrix<br/>'; printTable($table); echo '<br/><br/><br/>'; echo 'Transposed Matrix<br/>'; $table = transposeArray($table); printTable($table);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.2.00.0100.01018.03
7.1.120.0100.00717.23
7.1.110.0070.01116.15
7.1.100.0120.00616.39
7.1.90.0100.00616.10
7.1.80.0070.01516.46
7.1.70.0140.01115.54
7.1.60.0180.00933.28
7.1.50.0290.00333.11
7.1.40.0220.00632.51
7.1.30.0220.00632.57
7.1.20.0210.00732.63
7.1.10.0090.00614.68
7.1.00.0120.00414.82

preferences:
34.96 ms | 403 KiB | 5 Q