src/Utility/Matching.php
public static function matchAttribute($attr, $value, $subject) {
        $xml = new \XMLReader();
        $xml->xml($subject, 'UTF-8', LIBXML_NOERROR | LIBXML_ERR_NONE);

        // failed to parse => false
        if ($xml->read() === false) {
            return false;
        }

        return $xml->getAttribute($attr) === $value;
    }
public static function matchAttribute($attr, $value, $subject) {
        $xml = new \XMLReader();
        $xml->xml($subject, 'UTF-8', LIBXML_NOERROR | LIBXML_ERR_NONE);

        // failed to parse => false
        if ($xml->read() === false) {
            return false;
        }

        return $xml->getAttribute($attr) === $value;
    }
public static function matchAttribute ( $ attr , $ value , $ subject ) { $ xml = new \ XMLReader ( ) ; $ xml -> xml ( $ subject , 'UTF-8' , LIBXML_NOERROR | LIBXML_ERR_NONE ) ; // failed to parse => false if ( $ xml -> read ( ) === false ) { return false ; } return $ xml -> getAttribute ( $ attr ) === $ value ; }
Check if the first tag found in the given input string contains an attribute
with the given name and value.

@param string $attr Name of the attribute.
@param string $value Value of the attribute.
@param string $subject String to search.

@return bool True if an attribute with the given name/value was found, false
otherwize.
Check if the first tag found in the given input string contains an attribute with the given name and value .