Here is one that has stumped me today. I'm taking the HTML of a file and replacing any div's with the class "ecms" with the content in an array "data" then saving the file. Just now I have:
This works but it replaces all of the matches with only the first item in the "data" array. What I would like to do is replace each match with the subsequent item in the "data" array (don't worry about the matches and the array count being the same). Does anyone know how to do this?
Here is one that has stumped me today. I'm taking the HTML of a file and replacing any div's with the class "ecms" with the content in an array "data" then saving the file. Just now I have:
This works but it replaces all of the matches with only the first item in the "data" array. What I would like to do is replace each match with the subsequent item in the "data" array (don't worry about the matches and the array count being the same). Does anyone know how to do this?
http://nl.php.net/preg_match_all
maybe you could try that.
I did look at preg_match_all but I don't really know how to use it, and even if I did it doesn't do the replace functionality that I need.