public function StringInputStream::charsUntil in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php \Masterminds\HTML5\Parser\StringInputStream::charsUntil()
Read to a particular match (or until $max bytes are consumed).
This operates on byte sequences, not characters.
Matches as far as possible until we reach a certain set of bytes and returns the matched substring.
Parameters
string $bytes: Bytes to match.
int $max: Maximum number of bytes to scan.
Return value
mixed Index or false if no match is found. You should use strong equality when checking the result, since index could be 0.
Overrides InputStream::charsUntil
File
- vendor/
masterminds/ html5/ src/ HTML5/ Parser/ StringInputStream.php, line 254
Class
Namespace
Masterminds\HTML5\ParserCode
public function charsUntil($bytes, $max = null) {
if ($this->char >= $this->EOF) {
return false;
}
if ($max === 0 || $max) {
$len = strcspn($this->data, $bytes, $this->char, $max);
}
else {
$len = strcspn($this->data, $bytes, $this->char);
}
$string = (string) substr($this->data, $this->char, $len);
$this->char += $len;
return $string;
}