The DOMNode::isSupported() function is an inbuilt function in PHP which is used to check if the asked feature is supported for the specified version.
Syntax:
php
Output:
php
Output:
bool DOMNode::isSupported( 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 of feature to test.
<?php
// Write the feature name
$featureName1 = "Core";
// Check if it exists
$node1 = new DOMNode();
$isSupported1 = $node1->isSupported($featureName1, '1.0');
if ($isSupported1) {
echo "Has feature $featureName1 module<br>";
}
// Write another feature name
$featureName2 = "XML";
// Check if it exists
$isSupported2 = $node1->isSupported($featureName2, '2.0');
if ($isSupported2) {
echo "Has feature $featureName2 module";
}
?>
Has feature Core module Has feature XML moduleExample 2:
<?php
// Write the feature name
$featureName1 = "Events";
// Check if it exists
$node1 = new DOMNode();
$isSupported1 = $node1->isSupported($featureName1, '1.0');
if (!$isSupported1) {
echo "Doesn't has feature $featureName1 module<br>";
}
// Write another feature name
$featureName2 = "CSS";
// Check if it exists
$isSupported2 = $node1->isSupported($featureName2, '2.0');
if (!$isSupported2) {
echo "Doesn't has feature $featureName2 module";
}
?>
Doesn't has feature Events module Doesn't has feature CSS moduleReference: https://www.php.net/manual/en/domnode.issupported.php