3v4l.org

run code in 300+ PHP versions simultaneously
<?php # Helper to simulate the while $posts = function() { static $posts = 20; $posts--; return $posts < 0 ?: $posts; }; $counter = 0; echo "Looping Posts".PHP_EOL; while( $posts() ) { $counter++; echo "Post: {$counter}".PHP_EOL; if( $counter % 4 == 1 ) { /* template A? */ echo ' (A)~~> Posts: 1, 5, 9, 13, 17, etc…'.PHP_EOL; } elseif( $counter % 4 == 2 ) { /* template B? */ echo ' (B)~~> Posts: 2, 6, 10, 14, 18, etc…'.PHP_EOL; } elseif( $counter % 4 == 3 ) { /* template C? */ echo ' (C)~~> Posts: 3, 7, 11, 15, 19, etc…'.PHP_EOL; } elseif( $counter % 4 == 0 ) { /* template D? */ echo ' (D)~~> Posts: 4, 8, 12, 16, 20, etc…'.PHP_EOL; } }
Output for git.master, git.master_jit, rfc.property-hooks
Looping Posts Post: 1 (A)~~> Posts: 1, 5, 9, 13, 17, etc… Post: 2 (B)~~> Posts: 2, 6, 10, 14, 18, etc… Post: 3 (C)~~> Posts: 3, 7, 11, 15, 19, etc… Post: 4 (D)~~> Posts: 4, 8, 12, 16, 20, etc… Post: 5 (A)~~> Posts: 1, 5, 9, 13, 17, etc… Post: 6 (B)~~> Posts: 2, 6, 10, 14, 18, etc… Post: 7 (C)~~> Posts: 3, 7, 11, 15, 19, etc… Post: 8 (D)~~> Posts: 4, 8, 12, 16, 20, etc… Post: 9 (A)~~> Posts: 1, 5, 9, 13, 17, etc… Post: 10 (B)~~> Posts: 2, 6, 10, 14, 18, etc… Post: 11 (C)~~> Posts: 3, 7, 11, 15, 19, etc… Post: 12 (D)~~> Posts: 4, 8, 12, 16, 20, etc… Post: 13 (A)~~> Posts: 1, 5, 9, 13, 17, etc… Post: 14 (B)~~> Posts: 2, 6, 10, 14, 18, etc… Post: 15 (C)~~> Posts: 3, 7, 11, 15, 19, etc… Post: 16 (D)~~> Posts: 4, 8, 12, 16, 20, etc… Post: 17 (A)~~> Posts: 1, 5, 9, 13, 17, etc… Post: 18 (B)~~> Posts: 2, 6, 10, 14, 18, etc… Post: 19 (C)~~> Posts: 3, 7, 11, 15, 19, etc…

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:
71.14 ms | 403 KiB | 8 Q