View Single Post
Old 2012-04-18, 06:05 PM   #1
pc
Shift Out / X-On
 
pc's Avatar
 
Join Date: Jul 2007
Location: unknown
Posts: 2,298
Send a message via ICQ to pc
i'm stuck in counting new lines PHP

So I have a $ckeys['keywords'] string, (extract from head meta keywords ) that pretty much looks like this:

word
word
word
word
and so on, depends how many keywords there is.

Now I wrapped every new line into a separate <p> paragraph.

Quote:
<?php echo "<p id='cell1'>" . str_replace("\n", "</p><p id='cell1'>", $ckeys['keywords']) . "</p>"; ?>
What I would like to have is to have a counter for each new line and use this counter for id='cell1' so I could have id='cell1', id='cell2', id='cell3' ...

Anyone ?



pc is offline   Reply With Quote