menu

PHP Strings


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

strtoupper()

strtolower()

substr()

strrev()


2. Which of the following functions is used to count the number of occurrences of a substring in a string in PHP?

strpos()

str_replace()

substr_count()

strlen()


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

strcmp()

str_replace()

strlen()

substr()


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


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

substr()

str_replace()

explode()

implode()


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

htmlentities()

htmlspecialchars_decode()

htmlspecialchars()

str_replace()


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

strrev()

substr()

strlen()

trim()


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

htmlentities()

htmlspecialchars_decode()

htmlspecialchars()

str_replace()


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

strlen()

substr()

str_replace()

strcat()


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

strrev()

substr()

strlen()

strtolower()