views:

51

answers:

1

I have a large static table which is generated by a cgi script from a tmp file to a php file.

If it outputs

<td> </td>

Can I remove these with output buffering.

A: 

You could use preg_replace, it would look something like this

$str = '<tables><tr><td>bla</td><td> </td></tr></table>';
$str = preg_replace('/<td>\\s+<\/td>/', '', $str);

But keep in mind if you delete the whole blank td you need to manage the colspawn's so i would prefere something like this

$str = '<tables><tr><td>bla</td><td> </td></tr></table>';
$str = preg_replace('/<td>\\s+<\/td>/', '<td></td>', $str);
Dennis