3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php //$arr = array(1,2,3,4,5,6,7,8,9,0); $arr = array(1,2,3,4,5,6,7,8,9,0); $i = 0; $links_count = 4; $s = array(); while ($item = current($arr)) { $s[] = "<a href='#'>$item</a>\n"; next($arr); } var_dump(array_chunk($s, 4)); echo $s;
Output for 5.4.0 - 7.1.0
array(3) { [0]=> array(4) { [0]=> string(18) "<a href='#'>1</a> " [1]=> string(18) "<a href='#'>2</a> " [2]=> string(18) "<a href='#'>3</a> " [3]=> string(18) "<a href='#'>4</a> " } [1]=> array(4) { [0]=> string(18) "<a href='#'>5</a> " [1]=> string(18) "<a href='#'>6</a> " [2]=> string(18) "<a href='#'>7</a> " [3]=> string(18) "<a href='#'>8</a> " } [2]=> array(1) { [0]=> string(18) "<a href='#'>9</a> " } } Notice: Array to string conversion in /in/6Pt01 on line 19 Array
Output for 4.3.0 - 5.3.29
array(3) { [0]=> array(4) { [0]=> string(18) "<a href='#'>1</a> " [1]=> string(18) "<a href='#'>2</a> " [2]=> string(18) "<a href='#'>3</a> " [3]=> string(18) "<a href='#'>4</a> " } [1]=> array(4) { [0]=> string(18) "<a href='#'>5</a> " [1]=> string(18) "<a href='#'>6</a> " [2]=> string(18) "<a href='#'>7</a> " [3]=> string(18) "<a href='#'>8</a> " } [2]=> array(1) { [0]=> string(18) "<a href='#'>9</a> " } } Array