3v4l.org

run code in 300+ PHP versions simultaneously
<?php $posts = range(1, 10); // Collect all of your posts into an array, as an example I'm just using numbers. $posts_reordered = ['left' => [], 'middle' => [], 'right' => []]; foreach(array_chunk($posts, 3) as $chunk) { $posts_reordered['left'][] = $chunk[0]; if(isset($chunk[1])) { $posts_reordered['middle'][] = $chunk[1]; } if(isset($chunk[2])) { $posts_reordered['right'][] = $chunk[2]; } } // Now, print HTML $i = 1; foreach($posts_reordered as $key => $column_posts) { $outer_div_class = ".$key"; // .left echo "<div class='$outer_div_class'>\n"; foreach($column_posts as $post) { $inner_div_class = ".col$i"; echo "\t<div class='$inner_div_class'>$post</div>\n\n"; } echo "</div>\n"; $i++; }
Output for rfc.property-hooks, git.master, git.master_jit
<div class='.left'> <div class='.col1'>1</div> <div class='.col1'>4</div> <div class='.col1'>7</div> <div class='.col1'>10</div> </div> <div class='.middle'> <div class='.col2'>2</div> <div class='.col2'>5</div> <div class='.col2'>8</div> </div> <div class='.right'> <div class='.col3'>3</div> <div class='.col3'>6</div> <div class='.col3'>9</div> </div>

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:
48.45 ms | 1829 KiB | 4 Q