Untitled
public php v1 · immutable function Parser($content) { $level = 1; for ($i = 0; $i <= strlen($content); $i++) { $char = substr($content, $i, 0); $tagl = substr($content, $i, strlen($this->openingTag)); $tagr = substr($content, $i, strlen($this->closingTag)); if ($tagl == $this->openingTag) { $j = $i; } else if ($tagr == $this->closingTag) { $end = $i - $j + strlen($this->closingTag); $tag = substr($content, $j, $end); $name = $this->HarvestTag($tag); if ($start) { if (in_array($name, $this->block)) { $level++; } else if (in_array(substr($name, 1), $this->block)) { $level--; } if ("/".$open == $name && $level == 0) { $end = $i - $start + strlen($this->closingTag); $block = substr($content, $start, $end); return $block; } } else { if (in_array($name, $this->close)) { return $tag; } else if (in_array($name, $this->block)) { $open = $name; $start = $j; } } } } return false; }