3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ul = "<ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> </ul>"; function divideUl($ul) { $ulArray = explode(" ", $ul); array_pop($ulArray); array_shift($ulArray); $num = substr_count($ul, '<li>')/3; $sep = round($num); $string = "<ul>"; foreach ($ulArray as $i => $li) { if ($i % $sep === 0 && $i !== 0) $string .= "</ul>"; if ($i % $sep === 0 && $i !== 0) $string .= "<ul>"; $string .= $li; } $string .= "</ul>"; return $string; } echo divideUl($ul);
Output for git.master, git.master_jit, rfc.property-hooks
<ul><li>1</li><li>2</li></ul><ul><li>3</li><li>4</li></ul><ul><li>5</li><li>6</li></ul>

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