PHP | DOMNode isSupported() Function
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:
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.
Return Value: This function returns TRUE on success or FALSE on failure.
Below examples illustrate the DOMNode::isSupported() function in PHP:
Example 1:
<?php
$featureName1 = "Core" ;
$node1 = new DOMNode();
$isSupported1 = $node1 ->isSupported( $featureName1 , '1.0' );
if ( $isSupported1 ) {
echo "Has feature $featureName1 module<br>" ;
}
$featureName2 = "XML" ;
$isSupported2 = $node1 ->isSupported( $featureName2 , '2.0' );
if ( $isSupported2 ) {
echo "Has feature $featureName2 module" ;
}
?>
|
Output:
Has feature Core module
Has feature XML module
Example 2:
<?php
$featureName1 = "Events" ;
$node1 = new DOMNode();
$isSupported1 = $node1 ->isSupported( $featureName1 , '1.0' );
if (! $isSupported1 ) {
echo "Doesn't has feature $featureName1 module<br>" ;
}
$featureName2 = "CSS" ;
$isSupported2 = $node1 ->isSupported( $featureName2 , '2.0' );
if (! $isSupported2 ) {
echo "Doesn't has feature $featureName2 module" ;
}
?>
|
Output:
Doesn't has feature Events module
Doesn't has feature CSS module
Reference: https://www.php.net/manual/en/domnode.issupported.php
Last Updated :
28 Feb, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...