5kyy8lu3 Posted January 9, 2009 Share Posted January 9, 2009 I notice alot of people just add to one string all the html markup for a table in their loop, then they just echo that variable to make the table, is this a better way than how I do it? for example, what i do: for (blah, blah blah) { echo '<td>', $somearray, '</td>'; } vs how i see alot of other people do: for (blah, blah, blah) { $html_out .= '<td>' . $somearray . '</td>'; } echo $html_out; i ask this because my visitor log is pretty indepth and accesses a few tables for IP to country, last visit, browser info, etc and several functions i made, and it's gettin close to 200 rows in the html table now and the page seems like it's loading slower, though it might just be a bad week for my webhost, any input would rock, thanks Link to comment https://forums.phpfreaks.com/topic/140208-echo-html-markup-or-add-it-up-then-echo-it-as-one-big-string-for-big-tables/ Share on other sites More sharing options...
dennismonsewicz Posted January 9, 2009 Share Posted January 9, 2009 Personally, I usually echo out each HTML line and indent as you would in HTML to see any errors you may have typed by mistake Link to comment https://forums.phpfreaks.com/topic/140208-echo-html-markup-or-add-it-up-then-echo-it-as-one-big-string-for-big-tables/#findComment-733663 Share on other sites More sharing options...
Absorbator Posted January 9, 2009 Share Posted January 9, 2009 Your way (just "echo") should be faster. Storing data in a variable takes time too... ---------------- Now playing: Metallica - Sad but True via FoxyTunes Link to comment https://forums.phpfreaks.com/topic/140208-echo-html-markup-or-add-it-up-then-echo-it-as-one-big-string-for-big-tables/#findComment-733666 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.