Jump to content

customize implode


anups

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.