You are here

protected function simple_html_dom::copy_until_char in simplehtmldom API 5.2

Same name and namespace in other branches
  1. 6 simplehtmldom/simple_html_dom.php \simple_html_dom::copy_until_char()
  2. 7 simplehtmldom/simple_html_dom.php \simple_html_dom::copy_until_char()
2 calls to simple_html_dom::copy_until_char()
simple_html_dom::parse in simplehtmldom/simple_html_dom.php
simple_html_dom::read_tag in simplehtmldom/simple_html_dom.php

File

simplehtmldom/simple_html_dom.php, line 884

Class

simple_html_dom

Code

protected function copy_until_char($char) {
  if ($this->char === null) {
    return '';
  }
  if (($pos = strpos($this->doc, $char, $this->pos)) === 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 '';
  }
  $pos_old = $this->pos;
  $this->char = $this->doc[$pos];
  $this->pos = $pos;
  return substr($this->doc, $pos_old, $pos - $pos_old);
}