What is the significance of using substr() function in PHP when dealing with text manipulation?

The substr() function in PHP is significant for text manipulation as it allows you to extract a portion of a string based on a specified starting point and length. This can be useful for tasks such as truncating text, extracting specific sections of a string, or manipulating substrings within a larger text.

// Example of using substr() function to extract a portion of a string
$string = "Hello, World!";
$substring = substr($string, 0, 5); // Extracts the first 5 characters of the string
echo $substring; // Outputs "Hello"