menu

PHP Strings


1. Which of the following functions is used to convert an array to a string in PHP?

str_split()

explode()

implode()

substr()


2. Which of the following functions is used to insert a substring into a string at a specified position in PHP?

str_insert()

substr_replace()

str_replace()

str_splice()


3. Which of the following functions is used to split a string into an array of substrings in PHP?

substr()

str_replace()

explode()

implode()


4. Which of the following functions is used to trim whitespace from the beginning and end of a string in PHP?

strrev()

substr()

strlen()

trim()


5. What function is used to convert a string to all uppercase characters in PHP?

strtoupper()

strtolower()

substr()

strrev()


6. Which of the following functions is used to convert HTML entities to their corresponding characters in PHP?

htmlentities()

htmlspecialchars_decode()

htmlspecialchars()

str_replace()


7. Which of the following functions is used to replace a substring with another string in PHP?

strpos()

str_replace()

substr()

strtolower()


8. Which of the following functions is used to concatenate two or more strings in PHP?

strlen()

substr()

str_replace()

strcat()


9. Which of the following functions is used to convert a string to an array in PHP?

str_split()

explode()

implode()

substr()


10. Which of the following functions is used to join the elements of an array into a string in PHP?

substr()

str_replace()

explode()

implode()