I'm trying to use str_replace() to get rid of a bunch of useless text in a file I have. The problem is, the text file contains code and I think it is messing with my results. I have this so far:
$string = "<td style="width:150px;">Data1 </td><td style="width:150px;">Data2 </td><td style="width:150px;">Data3 </td>";
$replace = array("<td style="width:150px;">", " </td>");
$result = str_replace($replace, "", $string)
echo $result;
I think the reason it doesn't work is because the values in $string are not valid? Am I doing this the right way, or is there an easier method? I'm completely new to this so maybe it is something obvious?
I've been looking into preg_replace, but I'm not really sure that would solve my problem.