Html
<table>
<tr><td></td></tr> //1st row
<tr><td></td></tr> //2nd row
<tr><td></td></tr> //3rd row
<tr><td></td></tr> //4th row
<tr><td></td></tr> //5th row
</table>
What I want to do
if (intval($rows) > 3) {
delete all rows after 3rd row
}
I am using below php code to get html page
$index = substr_count(strtolower(file_get_contents('index.html')), '<tr>');
I hope my question clear enough to understand
Full code
<?php
$htaccess = file_get_contents('index.html');
$new_htaccess = str_replace('<table><tr><td>first row data</td></tr>', '<table><tr><td>first row data</td></tr><tr><td>sec row data</td></tr>', $htaccess);
$pos = strpos($htaccess, $ssa);
if ($pos == false) {
file_put_contents('index.html', $new_htaccess);
} else {
}
$index = substr_count(strtolower(file_get_contents('index.html')), '<tr>');
if (intval($index) > 20) {
//delete end rows and add a new one
}
?>