mits Posted October 5, 2010 Share Posted October 5, 2010 hi, i have an article with several paragraphs. However i would like the first paragraph to be converted into a header. string replacement will not work as it will replace all the p tags. i just want the 1st set of p tags to be replaced. can anyone help? thanks Quote Link to comment Share on other sites More sharing options...
iridys Posted October 5, 2010 Share Posted October 5, 2010 Do a search for the first </p> tag (I'm pretty sure you can limit it to first found, somehow) and chop off everything before that into a variable. Do the str_replace on the variable. Reattach to the rest. Or use preg_replace(). Brush up on regex-fu. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.