Re: preg_replace()

From: Date: Mon, 14 Apr 2003 18:08:49 +0000
Subject: Re: preg_replace()
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-143820@lists.php.net to get a copy of this message
> is html ALWAYS going to be that simple? No. It can be anything from various properties of the <td>-element, like width=200, name=cellname etc... The contents of the cells are not that stuctured aswell, and herein lies the problem, the complexity I want to make simple... What I want to do is that first I use substr_count($mytable, "<td"); to get the number of occurences of the <td> element. Then I want to give them an ID that corresponds to the place they come in the html, like the first <td> will have <td id=1>, the next <td id=2>, etc. I think I need more than just preg_replace(), but I can't see what that is... // Examples of html: $mytable = "<table> <tr> <td>cell 1</td> <td>cell 2</td> </tr> </table>"; $mytable = "<table border=1> <tr> <td width=200><a href=link.htm>link</a></td> <td height=10>contents</td> </tr> </table>"; // etc....

« previous php.general (#143820) next »