3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrays[] = array(); $arrays[] = array('user1'); $arrays[] = array('user1', 'user2'); $arrays[] = array('user1', 'user2', 'user3'); $arrays[] = array('user1', 'user2', 'user3', 'user4'); $arrays[] = array('user1', 'user2', 'user3', 'user4', 'user5'); foreach ($arrays as $i => $array) { $count = count($array); printf( "TEST %d: %s\n---\n", $i, match ($count) { 0 => 'nobody', 1 => $array[0], 2 => implode(' and ', $array), 3 => "{$array[0]}, {$array[1]}, and {$array[2]}", default => "{$array[0]}, {$array[1]}, {$array[2]}, and " . $count - 3 . " other" . ($count != 4 ? 's' : '') } ); }
Output for git.master, git.master_jit, rfc.property-hooks
TEST 0: nobody --- TEST 1: user1 --- TEST 2: user1 and user2 --- TEST 3: user1, user2, and user3 --- TEST 4: user1, user2, user3, and 1 other --- TEST 5: user1, user2, user3, and 2 others ---

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:
116.9 ms | 405 KiB | 5 Q