私はhtml文字列を持っています
html_string = '<div class="quote" post_id="48"
style="border:1px solid #000;padding:15px;margin:15px;" user_id="1"
user_name="rashidfarooq">This is not True</div>
<div class="quote" post_id="49" style="border:1px
solid #000;padding:15px;margin:15px;" user_id="1"
user_name="rashidfarooq">This is good for me</div>
<div class="genuine" post_id="49" style="border:1px
solid #000;padding:15px;margin:15px;" user_id="1"
user_name="rashidfarooq">This is good for me</div>';
class name="quote" の div を数えたい 試してみた
$dom = new DOMDocument;
$dom->loadHTML($html_string);
$divs = $dom->getElementsByTagName('div');
$length = $divs->length;
しかし、$length は div の総数を示します。class name = "quote" を持つ div のみをカウントするにはどうすればよいですか。それを行うことができるPHPネイティブ関数はありますか。