menu

PHP Strings


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

htmlentities()

htmlspecialchars_decode()

htmlspecialchars()

str_replace()


2. Which of the following functions is used to extract a substring from a string in PHP?

strpos()

str_replace()

substr()

strlen()


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

strrev()

substr()

strlen()

strtolower()


4. Which of the following functions is used to check if a string contains a specific substring in PHP?

strpos()

str_replace()

strstr()

substr()


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

str_split()

explode()

implode()

substr()


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

strlen()

substr()

str_replace()

strcat()


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

str_split()

explode()

implode()

substr()


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

substr()

str_replace()

explode()

implode()


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

htmlentities()

htmlspecialchars_decode()

htmlspecialchars()

str_replace()


10. Which of the following functions is used to find the position of the first occurrence of a substring in a string in PHP?

strpos()

str_replace()

strlen()

substr()