- preg_replace: documentation ( source)
<?php
$output = '<div class="center">
<table border="0" cellpadding="3" width="600">
<tr><td class="e">ctype functions </td><td class="v">enabled </td></tr>
</table><br />
<table></table>';
$output1 = preg_replace('#<table[^>]*>#', '<table class="table table-striped adminlist">', $output);
echo $output[1][0] . PHP_EOL . PHP_EOL . $output1;