3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrayTable = [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], ]; $i = 0; $transpose = []; while ($columns = array_column($arrayTable, $i++)) { $transpose[] = $columns; } $table = '<table border="1">'; $rows = count($transpose); for ($i = 0; $i < $rows; $i++){ $cols = count($transpose[$i]); $table .= '<tr>'; for ($j = 0; $j < $cols; $j++) { $table .= '<td>' . $transpose[$i][$j] . '</td>'; } $table .= '</tr>'; } $table .= '</table>'; echo $table;
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
<table border="1"><tr><td>1</td><td>6</td></tr><tr><td>2</td><td>7</td></tr><tr><td>3</td><td>8</td></tr><tr><td>4</td><td>9</td></tr><tr><td>5</td><td>10</td></tr></table>
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
181.2 ms | 407 KiB | 5 Q