PHP Strings
PHP Strings - Important Points
6. | Which of the following functions is used to trim whitespace from the beginning and end of a string in PHP? |
---|
A. strrev()
B. substr()
C. strlen()
D. trim()
View Answer Discuss Work SpaceAnswer: option d
Explanation:
The trim() function is used to trim whitespace from the beginning and end of a string in PHP.
7. | Which of the following functions is used to find the position of the first occurrence of a substring in a string in PHP? |
---|
A. strpos()
B. str_replace()
C. strlen()
D. substr()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The strpos() function is used to find the position of the first occurrence of a substring in a string in PHP.
8. | Which of the following functions is used to reverse a string in PHP? |
---|
A. strrev()
B. substr()
C. strlen()
D. strtolower()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The strrev() function is used to reverse a string in PHP.
9. | Which of the following functions is used to split a string into an array of substrings in PHP? |
---|
A. substr()
B. str_replace()
C. explode()
D. implode()
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The explode() function is used to split a string into an array of substrings in PHP.
10. | Which of the following functions is used to join the elements of an array into a string in PHP? |
---|
A. substr()
B. str_replace()
C. explode()
D. implode()
View Answer Discuss Work SpaceAnswer: option d
Explanation:
The implode() function is used to join the elements of an array into a string in PHP.