PHP Classes

The search for the closing tag does not have to start from th...

Recommend this page to a friend!

      Extract Text Between Long Tags  >  All threads  >  The search for the closing tag does...  >  (Un) Subscribe thread alerts  
Subject:The search for the closing tag does...
Summary:Package rating comment
Messages:1
Author:Marcel
Date:2008-10-20 06:07:05
 

Marcel rated this package as follows:

Utility: Sufficient
Consistency: Sufficient
Examples: Good

  1. The search for the closing tag does...   Reply   Report abuse  
Picture of Marcel Marcel - 2008-10-20 06:07:05
The search for the closing tag does not have to start from the beginning of the string. It makes more sense an dis more efficient to start searching AFTER the opening tag. This also allows to search for tags that do have a distinct opening tag and a generic closing tag (e.g. Dreamweaver editable regions. I would suggest changing
$mytext = substr($string,$start,intval(strpos($string,$ct) - $start));
to
$mytext = substr($string,$start,intval(strpos($string,$ct,$start) - $start));
which uses the position of the opening tag as an offset for finding the closing tag.

Cheers, Marcello