menu

PHP Strings


1. Which of the following functions is used to compare two strings in PHP?

strcmp()

str_replace()

strlen()

substr()


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

substr()

str_replace()

explode()

implode()


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

htmlentities()

htmlspecialchars_decode()

htmlspecialchars()

str_replace()


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

strtoupper()

strtolower()

substr()

strrev()


5. Which of the following functions is used to reverse a string in PHP?

strrev()

substr()

strlen()

strtolower()


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

substr()

str_replace()

explode()

implode()


7. Which of the following functions is used to pad a string with a specified character to a certain length in PHP?

str_pad()

str_replace()

substr()

strlen()


8. What function is used to convert a string to all lowercase characters in PHP?

strtolower()

strtoupper()

substr()

strrev()


9. 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()


10. Which of the following functions is used to convert special characters to HTML entities in PHP?

htmlentities()

htmlspecialchars_decode()

htmlspecialchars()

str_replace()