PHP | DOMNode isDefaultNamespace() Function Last Updated : 27 Feb, 2020 Comments Improve Suggest changes Like Article Like Report The DOMNode::isDefaultNamespace() function is an inbuilt function in PHP which is used to check if the specified namespaceURI is the default namespace or not. Syntax: bool DOMNode::isDefaultNamespace( string $namespaceURI ) Parameters: This function accepts a single parameter $namespaceURI which holds the namespace URI. Return Value: This function return TRUE if namespaceURI is the default namespace, FALSE otherwise. Below examples illustrate the DOMNode::isDefaultNamespace() function in PHP: Example 1: php <?php // Create a new DOMDocument $dom = new DOMDocument(); // Create a paragraph element with a namespace $p_element = $dom->createElementNS( 'my_namespace', 'p', 'GeeksforGeeks'); // Append the child to DOMDocument $dom->appendChild($p_element); // Check if the namespace is default or not if($dom->isDefaultNamespace('my_namespace')) { echo 'Yes, my_namespace is the default namespace.'; } ?> Output: Yes, my_namespace is the default namespace. Example 2: php <?php // Create a new DOMDocument $dom = new DOMDocument(); // Create a paragraph element with a namespace $p_element = $dom->createElementNS( 'my_namespace', 'p', 'GeeksforGeeks'); // Append the child to DOMDocument $dom->appendChild($p_element); // Check if the namespace is default or not if(!$dom->isDefaultNamespace('some_other_namespace')) { echo 'No, some_other_namespace is not' . ' default namespace.'; } ?> Output: No, some_other_namespace is not the default namespace. Reference: https://www.php.net/manual/en/domnode.isdefaultnamespace.php Comment More infoAdvertise with us Next Article PHP | DOMNode isDefaultNamespace() Function gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-DOM Similar Reads PHP | DOMNode lookupNamespaceUri() Function The DOMNode::lookupNamespaceUri() function is an inbuilt function in PHP which is used to get the namespace URI of the node based on the prefix. Syntax: string DOMNode::lookupNamespaceUri( string $prefix ) Parameters: This function accepts a single parameter $prefix which holds the prefix. Return Va 1 min read PHP | DOMNode isSameNode() Function The DOMNode::isSameNode() function is an inbuilt function in PHP which indicates if two nodes are the same node or not. Syntax: bool DOMNode::isSameNode( DOMNode $node ) Parameters: This function accepts a single parameter $node which holds the node to be compared. Return Value: This function return 2 min read PHP | DOMNode insertBefore() Function The DOMNode::insertBefore() function is an inbuilt function in PHP which is used to insert a new node before a certain another node. Syntax: DOMNode DOMNode::insertBefore( DOMNode $newNode, DOMNode $refNode ) Parameters:This function accepts two parameters as mentioned above and described below: $ne 2 min read 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 describe 2 min read PHP | DOMNode getLineNo() function The DOMNode::getLineNo() function is an inbuilt function in PHP which is used to get the line number for where the node is defined. Syntax: DOMNode DOMNode::getLineNo( void ) Parameters:This function doesnât accept any parameter. Return Value: This function returns the line number where the node was 2 min read Like