Re: HTML Table into 2D array

From: Date: Tue, 04 Jul 2000 02:57:27 +0000
Subject: Re: HTML Table into 2D array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-4663@lists.php.net to get a copy of this message
In article <4.2.0.58.20000703202712.00c3ce30@mail.btinternet.com>, adamcharnock@btinternet.com (Adam Charnock) wrote: > Hello. Does anyone know if it is possible to convert a HTML table into a 2D > array? Or is there some code snippet out there that does it for you? Here's a start: $html = "<TABLE><TR><TD>a</TD><TD>b</TD></TR><TD>1</TD><TD>2</TD></TR></TABLE>"; $rowdata = pregi_replace("<TABLE*>", "", $html); $rowdata = pregi_replace("</TABLE>", "", $rowdata); $rows = pregi("<TR*>", $rowdata); while (list($index,$row) = each($rows)){ $rows[$index] = pregi("<TD*>", $row); } Disclaimer: You can be pretty certain I got the Regex all wrong :-) -- Richard Lynch | If this was worth $$$ to you, buy a CD US Customer Support Director | from one of the artists listed here: Zend Technologies USA | http://www.L-I-E.com/artists.htm http://www.zend.com | (this has nothing to do with Zend, duh!)

« previous php.general (#4663) next »