PHP | DOMCharacterData deleteData() Function Last Updated : 20 Feb, 2020 Comments Improve Suggest changes Like Article Like Report The DOMCharacterData::deleteData() function is an inbuilt function in PHP which is used to remove a range of characters from the node. Syntax: void DOMCharacterData::deleteData( int $offset, int $count ) Parameters: This function accept two parameters as mentioned above and described below: $offset: It specifies the starting position to deleted data. $count: It specifies the number of characters to delete. Return Value: This function does not return any value. Below given programs illustrate the DOMCharacterData::deleteData() function in PHP: Program 1: php <?php // Create a new DOM Document $dom = new DOMDocument('1.0', 'iso-8859-1'); // Create a div element $element = $dom->appendChild(new DOMElement('div')); // Create a DOMCdataSection $text = $element->appendChild( new DOMCdataSection('DOMC Data')); // Delete all data $text->deleteData(0, 9); echo $dom->saveXML(); ?> <?xml version="1.0" encoding="iso-8859-1"?> <div><![CDATA[]]></div> Output: Use Chrome Developer tools to view the HTML or press Ctrl+U Program 2: php <?php // Create a new DOM Document $dom = new DOMDocument('1.0', 'iso-8859-1'); // Create a div element $element = $dom->appendChild(new DOMElement('div')); // Create a DOMCdataSection $text = $element->appendChild( new DOMCdataSection('DOMC Data')); // Delete all data $text->deleteData(0, 9); // Adding new data again $text->insertData(0, 'New data'); echo $dom->saveXML(); ?> <?xml version="1.0" encoding="iso-8859-1"?> <div><![CDATA[New data]]></div> Output: Reference: https://www.php.net/manual/en/domcharacterdata.deletedata.php Comment More infoAdvertise with us Next Article PHP | DOMCharacterData deleteData() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-DOM Similar Reads PHP | DOMCharacterData appendData() Function The DOMCharacterData::appendData() function is an inbuilt function in PHP which is used to append the string to the end of the character data of the node. Syntax: public DOMCharacterData::appendData( string $data ) Parameters: This function accepts a single parameter $data which holds the string tha 2 min read PHP | DOMCharacterData replaceData() Function The DOMCharacterData::replaceData() function is an inbuilt function in PHP which is used to replace a substring within the DOMCharacterData node. Syntax: void DOMCharacterData::replaceData( int $offset, int $count, string $data) Parameters: This function accept three parameters as mentioned above an 2 min read PHP | DOMCharacterData insertData() Function The DOMCharacterData::insertData() function is an inbuilt function in PHP which is used to insert a string at the specified 16-bit unit offset. Syntax: void DOMCharacterData::insertData( int $offset, string $data ) Parameters: This function accept two parameters as mentioned above and described belo 2 min read PHP | DOMCharacterData substringData() Function The DOMCharacterData::substringData() function is an inbuilt function in PHP which is used to extracts a range of data from the node. Syntax: string DOMCharacterData::substringData( int $offset, int $count ) Parameters: This function accept two parameters as mentioned above and described below: $off 2 min read PHP | ftp_delete() function The ftp_delete() function is an inbuilt function in PHP which is used to delete a file on the FTP server. Syntax:Â ftp_delete( $ftp_connection, $file ) Parameters: This function accepts two parameters as mentioned above and described below:Â Â $ftp_connection: It is required parameter. It specifies t 2 min read Like