I want all the trs tds and ths extracted
PHP Code:
<?php
$text 
'
<table>
<tr>
<th>Unit Type</th>
<th>Availability</th>
<th>Rates</th>
</tr>

<tr>
<td>One Bedroom</td>
<td>Call for Availability</td>
<td>hello</td>
</tr>

<tr>
<td>One Living Room</td>
<td>Call for Availability</td>
<td>hello</td>
</tr>
</table>'
;
$extract_th="#<th.*>(.+)</th#Ui";
$extract_tr="/<tr>(.*)<\/tr>/isU";
$extract_td="/<td.*>(.*)<\/td>/Ui";
echo 
$text."<br />\n";
preg_match_all($extract_tr$text$match_trPREG_SET_ORDER);
//print_r($match_tr[1][1]);
for($i=0$i<count($match_tr); $i++){
    for(
$td=0$td<count($match_tr[$i]); $td++){
        
preg_match_all($extract_td$match_tr[$i][$td], $match_tdPREG_SET_ORDER);
        
print_r($match_td[$i]);
    }
}
?>
I'm getting:
Code:
Array
(
    [0] => <td>Call for Availability</td>
    [1] => Call for Availability
)
Array
(
    [0] => <td>Call for Availability</td>
    [1] => Call for Availability
)
Array
(
    [0] => <td>hello</td>
    [1] => hello
)
Array
(
    [0] => <td>hello</td>

    [1] => hello
)