anups Posted November 15, 2010 Share Posted November 15, 2010 Hi All, Just now I had a thought in mind for using regular expression in implode. I know I can get the solution using foreach loop but just trying whether can we do it without using foreach. I have an array here I want to create a table with array. I can do it using for or foreach loop but just a thought came in my mind doing it without using loop. $arr = array(1,2,3,4,5); echo "<table border='2'>"; echo "<tr>".implode("<td>[u]I WANT MY VALUES HERE[/u]</td>",$arr)."</tr>"; echo "</table>"; can we pass regular expression in implode() so that i will get record something like this <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> Link to comment https://forums.phpfreaks.com/topic/218700-customize-implode/ Share on other sites More sharing options...
mikecampbell Posted November 15, 2010 Share Posted November 15, 2010 No, but there's nothing stopping you from doing this: $arr = array(1,2,3,4,5); echo "<table border='2'>"; echo "<tr><td>".implode("</td><td>",$arr)."</td></tr>"; echo "</table>"; Link to comment https://forums.phpfreaks.com/topic/218700-customize-implode/#findComment-1134322 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.