jacob1986 Posted December 2, 2015 Share Posted December 2, 2015 I have the following code (as below), but I cannot seem to make a new line (i,.e. 1: 1,2,3,4 and then make a new line with 3: 1,2,3,4). As it only prints 1: 1,2,3,4 3: 1,2,3,4 - all I need is: 1: 1,2,3,4 3: 1,2,3,4 ****************************************************** <?php$array = array( 1 => range (1, 4), 2 => range (1, 4), 3 => range (1, 4));$numbers = count($array);for ($i = 1; $i <= $numbers; $i += 2) { echo $i . ': ' . implode(',', $array[$i]) . PHP_EOL;}?> *************************************************************************** Quote Link to comment https://forums.phpfreaks.com/topic/299625-help-with-array-new-line/ Share on other sites More sharing options...
Jacques1 Posted December 2, 2015 Share Posted December 2, 2015 (edited) The PHP_EOL constant represents a newline character (e. g. the ASCII LF character on Linux). This only affects the source code of the HTML document. If you want to start a new line in your rendered document, you need an HTML line break element: <br>. Or better yet, use lists. Edited December 2, 2015 by Jacques1 Quote Link to comment https://forums.phpfreaks.com/topic/299625-help-with-array-new-line/#findComment-1527455 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.