3v4l.org - online PHP & HHVM shell, execute code in 100+ different versions!

<?php $value['title'] = range(0, 10); $max = count($value['title']); $i = 0; $count = 4; $str = ''; foreach ($value['title'] as $key2) { if ($i % $count == 0) $str .= "<ul>" . PHP_EOL; $str .= "<li><a href='#'>$key2</a></li>" . PHP_EOL; if ($i % $count == $count - 1 || $i == $max - 1) $str .= "</ul>" . PHP_EOL; $i++; } echo $str;
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.3, php7@20140507 - 20141101, hhvm-3.0.1 - 3.4.0
<ul> <li><a href='#'>0</a></li> <li><a href='#'>1</a></li> <li><a href='#'>2</a></li> <li><a href='#'>3</a></li> </ul> <ul> <li><a href='#'>4</a></li> <li><a href='#'>5</a></li> <li><a href='#'>6</a></li> <li><a href='#'>7</a></li> </ul> <ul> <li><a href='#'>8</a></li> <li><a href='#'>9</a></li> <li><a href='#'>10</a></li> </ul>
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 11 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 16 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 11 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 16 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 11 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f6cAl on line 16 <ul>PHP_EOL<li><a href='#'>0</a></li>PHP_EOL<li><a href='#'>1</a></li>PHP_EOL<li><a href='#'>2</a></li>PHP_EOL<li><a href='#'>3</a></li>PHP_EOL</ul>PHP_EOL<ul>PHP_EOL<li><a href='#'>4</a></li>PHP_EOL<li><a href='#'>5</a></li>PHP_EOL<li><a href='#'>6</a></li>PHP_EOL<li><a href='#'>7</a></li>PHP_EOL</ul>PHP_EOL<ul>PHP_EOL<li><a href='#'>8</a></li>PHP_EOL<li><a href='#'>9</a></li>PHP_EOL<li><a href='#'>10</a></li>PHP_EOL</ul>PHP_EOL