Skip to content
Related Articles

Related Articles

Improve Article

PHP | DOMText isElementContentWhitespace() Function

  • Last Updated : 13 Mar, 2020

The DOMText::isElementContentWhitespace() function is an inbuilt function in PHP which is used to check whether this text node contains whitespace in element content or not.


bool DOMText::isElementContentWhitespace( void )

Parameters: This function doesn’t accept any parameters.

Return Value: This function returns TRUE on success or FALSE on failure.

Below given programs illustrate the DOMText::isElementContentWhitespace() function in PHP:

Program 1:

// Create the text Node with no whitespace
$text = new DOMText('No_Space');
// Check if whitespace is not there
if(!$text->isElementContentWhitespace()) {
    echo 'No ! Whitespace is not there.';


No ! Whitespace is not there.

Program 2:

// Create the text Node with a space
$text = new DOMText('Yes Space');
// Check if whitespace is there
if($text->isElementContentWhitespace()) {
    echo 'Yes ! Whitespace is there.';


Yes ! Whitespace is there.


My Personal Notes arrow_drop_up
Recommended Articles
Page :