src/Bookworm/Bookworm.php
private static function countImages($text)
    {
        // Count markdown images from text
        $markdownImages = preg_match_all('/!\[([^\[]+)\]\(([^\)]+)\)/i', $text, $matches);
        // Count image tags from text
        $imgTags = preg_match_all('/<img[^>]*>/i', $text, $matches);

        return $markdownImages + $imgTags;
    }
private static function countImages($text)
    {
        // Count markdown images from text
        $markdownImages = preg_match_all('/!\[([^\[]+)\]\(([^\)]+)\)/i', $text, $matches);
        // Count image tags from text
        $imgTags = preg_match_all('/<img[^>]*>/i', $text, $matches);

        return $markdownImages + $imgTags;
    }
private static function countImages ( $ text ) { // Count markdown images from text $ markdownImages = preg_match_all ( '/!\[([^\[]+)\]\(([^\)]+)\)/i' , $ text , $ matches ) ; // Count image tags from text $ imgTags = preg_match_all ( '/<img[^>]*>/i' , $ text , $ matches ) ; return $ markdownImages + $ imgTags ; }
Counts how many images are in a specific text.

@param string $text The text from which the words should be counted

@return int
Counts how many images are in a specific text .