3v4l.org

run code in 300+ PHP versions simultaneously
<?php $max = 100; // The last number $cols = 5; // The point at which a new line will start $arr = array_chunk(range(1, $max), $cols); // Magic ;D // Print the data. foreach ($arr as $key => $row) { // This will reverse every other row $row = ($key % 2 === 0) ? $row : array_reverse($row); foreach ($row as $value) { $value = str_pad($value, strlen($max), ' ', STR_PAD_LEFT); echo "{$value} "; } echo "\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 20 19 18 17 16 21 22 23 24 25 30 29 28 27 26 31 32 33 34 35 40 39 38 37 36 41 42 43 44 45 50 49 48 47 46 51 52 53 54 55 60 59 58 57 56 61 62 63 64 65 70 69 68 67 66 71 72 73 74 75 80 79 78 77 76 81 82 83 84 85 90 89 88 87 86 91 92 93 94 95 100 99 98 97 96

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.49 ms | 402 KiB | 8 Q