PHPHtmlParser\Content::skip PHP Method

skip() public method

Skip a given set of characters.
public skip ( string $string, boolean $copy = false )
$string string
$copy boolean
    public function skip($string, $copy = false)
    {
        $len = strspn($this->content, $string, $this->pos);
        // make it chainable if they don't want a copy
        $return = $this;
        if ($copy) {
            $return = substr($this->content, $this->pos, $len);
        }
        // update the position
        $this->pos += $len;
        return $return;
    }

Usage Example

示例#1
0
 public function testSkipCopy()
 {
     $content = new Content('abcdefghijkl');
     $this->assertEquals('abcd', $content->skip('abcd', true));
 }