In PHP I need to search through my $post content and find all the opening <table>
tags to add a unique class name based on its index. I know the code below is wrong but hopefully gets the point across.
$content = '<table></table><p></p><table></table><p></p><table></table><p></p>';
preg_match_all('/find all <table> tags/', $content, $matches);
for ($i=0; $i < count($matches); $i++) {
$new_value = '<table class=""' . $i . ' >';
str_replace( $matches[$i], $new_value, $content);
}