sumolotokai Posted January 27, 2010 Share Posted January 27, 2010 Hi again, I have written the code below to create a function with four arguments that returns a string that contains a table element. This will contain each of the variables in its own cell. I was wondering, is this the best way to do it and if not, what is? <?php function x ($a, $b, $c, $d) { echo "<table border=\"1\" cellpadding=\"4\" cellspacing=\"4\">\n"; echo "<tr><td>$a</td></tr>"; echo "<tr><td>$b</td></tr>"; echo "<tr><td>$c</td></tr>"; echo "<tr><td>$d</td></tr></table>"; } echo x ('bert', 'ernie', 'geoff', 'pat'); ?> Thanks in advance Sumo Link to comment https://forums.phpfreaks.com/topic/190047-the-best-way-to-create-the-function-function-creates-html-table/ Share on other sites More sharing options...
teamatomic Posted January 27, 2010 Share Posted January 27, 2010 Perfectly acceptable way of doing it. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/190047-the-best-way-to-create-the-function-function-creates-html-table/#findComment-1002681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.