What is the purpose of the substr() function in PHP?

  • To extract a substring from a string
  • To concatenate two strings
  • To convert a string to uppercase
  • To remove leading and trailing whitespace
The substr() function in PHP is used to extract a substring from a string. It takes the string and the starting position as parameters and optionally the length of the substring. This function is commonly used for manipulating strings and extracting specific portions of text. Learn more: http://php.net/manual/en/function.substr.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *