I have the following string
$data = '
<tr>
<td>Section Head 1</td>
<td>DATA DATA DATA DATA 1</td>
</tr>
<tr>
<td>Section Head 2</td>
<td>DATA DATA DATA DATA 2</td>
</tr>';
I want to modify it to become like this:
<tr>
<td width="25%;">Section Head 1</td>
<td width="75%;">DATA DATA DATA DATA 1</td>
</tr>
<tr>
<td width="25%;">Section Head 2</td>
<td width="75%;">DATA DATA DATA DATA 2</td>
</tr>
I'm trying to use preg_replace('td', '$1 width="25%"', $data);
But I'm stuck, I cant figure out how to do this in a single preg_replace