3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ids = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110]; $users = [1,2,3,4,5]; // Temporary copy of users $user_ids = []; foreach( $ids as $id ){ // If our copy is empty, reload it if(!$user_ids){ $user_ids = $users; } // Use array_shift() to grab and remove from the front echo sprintf('%1$d - %2$d', $id, array_shift($user_ids)), PHP_EOL; } echo PHP_EOL; foreach( $ids as $idx => $id ){ echo sprintf('%1$d - %2$d', $id, ($idx % 5) + 1 ), PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
100 - 1 101 - 2 102 - 3 103 - 4 104 - 5 105 - 1 106 - 2 107 - 3 108 - 4 109 - 5 110 - 1 100 - 1 101 - 2 102 - 3 103 - 4 104 - 5 105 - 1 106 - 2 107 - 3 108 - 4 109 - 5 110 - 1

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