src/SimpleDOM.php
public function getAttribute($strName, $varDefault = false)
    {
        if (isset($this->attributes()->$strName) && (((string)$this->attributes()->$strName) !== '')) {
            return (string)$this->attributes()->$strName;
        } else {
            return $varDefault;
        }
    }
public function getAttribute($strName, $varDefault = false)
    {
        if (isset($this->attributes()->$strName) && (((string)$this->attributes()->$strName) !== '')) {
            return (string)$this->attributes()->$strName;
        } else {
            return $varDefault;
        }
    }
Get an attribute by name

@param string $strName
@param bool $varDefault
@return bool|string