You are here

protected function simple_html_dom::copy_until_char_escape in simplehtmldom API 7

Same name and namespace in other branches
  1. 5.2 simplehtmldom/simple_html_dom.php \simple_html_dom::copy_until_char_escape()
  2. 6 simplehtmldom/simple_html_dom.php \simple_html_dom::copy_until_char_escape()
2 calls to simple_html_dom::copy_until_char_escape()
simple_html_dom::parse_attr in simplehtmldom/simple_html_dom.php
simple_html_dom::read_tag in simplehtmldom/simple_html_dom.php

File

simplehtmldom/simple_html_dom.php, line 901

Class

simple_html_dom

Code

protected function copy_until_char_escape($char) {
  if ($this->char === null) {
    return '';
  }
  $start = $this->pos;
  while (1) {
    if (($pos = strpos($this->doc, $char, $start)) === false) {
      $ret = substr($this->doc, $this->pos, $this->size - $this->pos);
      $this->char = null;
      $this->pos = $this->size;
      return $ret;
    }
    if ($pos === $this->pos) {
      return '';
    }
    if ($this->doc[$pos - 1] === '\\') {
      $start = $pos + 1;
      continue;
    }
    $pos_old = $this->pos;
    $this->char = $this->doc[$pos];
    $this->pos = $pos;
    return substr($this->doc, $pos_old, $pos - $pos_old);
  }
}