count() public method

Counts nodes for a given XPath expression or a CSS selector.
public count ( string $expression, string $type = Query::TYPE_CSS ) : integer
$expression string XPath expression or CSS selector
$type string The type of the expression
return integer
Example #1
0
 public function testCount()
 {
     $html = '<ul><li>One</li><li>Two</li><li>Three</li></ul>';
     $document = new Document($html, false);
     $this->assertEquals(3, $document->count('li'));
     $document = new Document();
     $this->assertEquals(0, $document->count('li'));
 }