Ron Piggott wrote:
I have a series of questions.

How do I count the number of <br /> 's in a string?

How do I add text in the middle of a string, let's say after the 3rd
<br />

Ron


simplest way from experience is to simply explode('<br />', $the_string)
you can then count the array -1 for number of br's; and add text to the front and end of each; or indeed add/remove paragraphs before imploding it back together.

If you want more power, most would say use regex or str_ functions, however I'd recommend getting used to the DOMDocument to traverse the html and make fine grained adjustments.


regards,

--
nathan ( [EMAIL PROTECTED] )
{
  Senior Web Developer
  php + java + flex + xmpp + xml + ecmascript
  web development edinburgh | http://kraya.co.uk/
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to