The DOMText::splitText() function is an inbuilt function in PHP which is used to break a node into two nodes at the specified offset.
DOMText DOMText::splitText( int $offset )
Parameters: This function accepts a single parameter $offset which holds the offset to split.
Return Value: This function returns a new node of the same type, which contains all the content at and after the offset.
Below given programs illustrate the DOMText::splitText() function in PHP:
Number of text nodes before splitting: 1 Number of text nodes after splitting: 1
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.