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
Loading...
Related Quiz
- Which of the following statements in PHP can output strings, variables, and HTML code?
- Which of the following are features of PHP?
- You can call a user-defined function in PHP using a string variable that contains the function's name.
- Which of the following are ways to handle cookies in PHP?
- Which of the following are true about the break and continue statements in PHP?