PHP script modification for cms on zend framework

PHP script modification for cms on zend framework

Closed - This job posting has been filled and work has been completed.

Job Description

Custom made CMS running on PHP and Zend framework. The script is taking a tag from the database and converting it into php code. It currently works but is taking too much time and slowing the system down.

DETAILS:

The tags are:

<INCLUDEFILE-X-serverpath/file.php>

Where X is the number of a unique INCLUDEFILE, there are multiple include files in the code.

The code is:

for($i=1; $i <= 9; $i++){
$ipos1 = strpos($html, 'INCLUDEFILE'.$i.'-');
$ipos2 = strpos($html, '>', $ipos1 + 13);
$includefile = substr($html, $ipos1 + 13, ($ipos2 - $ipos1 - 13));

if (is_file($includefile)) {
ob_start();
include $includefile;
$icontents = ob_get_contents();
ob_end_clean();
}else{
$icontents = '';
}
$html = str_replace('<INCLUDEFILE'.$i.'-'.$includefile.'>', $icontents, $html);
}

DESIRED RESULT:

Need to change the code to a more efficient and faster method as this code is causing pages to be rendered very slowly.