PHP | DOMImplementation hasFeature() Function Last Updated : 26 Feb, 2020 Comments Improve Suggest changes Like Article Like Report The DOMImplementation::hasFeature() function is an inbuilt function in PHP which is used to test if the DOM implementation implements a specific feature or not. Syntax: bool DOMImplementation::hasFeature( string $feature, string $version ) Parameters: This function accepts two parameters as mentioned above and described below: $feature: It specifies the feature to test. $version: It specifies the version number of the feature to test. Return Value: This function returns TRUE on success or FALSE on failure. Exceptions: This function throws E_STRICT exception on error. Below examples illustrate the DOMImplementation::hasFeature() function in PHP: Example 1: php <?php // Write the feature name $featureName1 = "Core"; // Check if it exists $hasFeature1 = DOMImplementation::hasFeature($featureName1, '1.0'); if ($hasFeature1) { echo "Has feature $featureName1 module <br>"; } // Write another feature name $featureName2 = "XML"; // Check if it exists $hasFeature2 = DOMImplementation::hasFeature($featureName2, '2.0'); if ($hasFeature2) { echo "Has feature $featureName2 module <br>"; } ?> Output: Has feature Core module Has feature XML module Example 2: php <?php // Write the feature name $featureName1 = "Events"; // Check if it doesn't exists $hasFeature1 = DOMImplementation::hasFeature($featureName1, '1.0'); if (!$hasFeature1) { echo "Doesn't have feature $featureName1 module. <br>"; } // Write another feature name $featureName2 = "CSS"; // Check if it doesn't exists $hasFeature2 = DOMImplementation::hasFeature($featureName2, '2.0'); if (!$hasFeature2) { echo "Doesn't have feature $featureName2 module. <br>"; } ?> Output: Doesn't have feature Events module. Doesn't have feature CSS module. Reference: https://www.php.net/manual/en/domimplementation.hasfeature.php Comment More infoAdvertise with us Next Article PHP | DOMImplementation hasFeature() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-DOM Similar Reads PHP | DOMElement hasAttribute() Function The DOMElement::hasAttribute() function is an inbuilt function in PHP which is used to know whether attribute with a specific name exists as a member of the element. Syntax: bool DOMElement::hasAttribute( string $name ) Parameters: This function accepts a single parameter $name which holds the name 1 min read PHP | DOMElement hasAttributeNS() Function The DOMElement::hasAttributeNS() function is an inbuilt function in PHP which is used to know whether attribute in specific namespace named localName exists as a member of the element or not. Syntax: bool DOMElement::hasAttributeNS( string $namespaceURI, string $localName ) Parameters: This function 2 min read PHP | DOMImplementation __construct() Function The DOMImplementation::__construct() function is an inbuilt function in PHP which is used to create a new DOMImplementation object. Syntax: DOMImplementation::__construct( void ) Parameters: This function doesnât accept any parameter. Below examples illustrate the DOMImplementation::__construct() fu 1 min read PHP | DOMElement getAttribute() Function The DOMElement::getAttribute() function is an inbuilt function in PHP which is used to get the value of the attribute with name for the current node. Syntax: string DOMElement::getAttribute( string $name ) Parameters: This function accepts a single parameter $name which holds the name of the attribu 1 min read PHP | DOMElement getAttributeNS() Function The DOMElement::getAttributeNS() function is an inbuilt function in PHP which is used to get the value of the attribute in a specific namespace with local name for the current node. Syntax: string DOMElement::getAttributeNS( string $namespaceURI, string $localName ) Parameters: This function accepts 2 min read Like