PHP Strings
PHP Strings - Important Points
11. | Which of the following functions is used to convert special characters to HTML entities in PHP? |
---|
A. htmlentities()
B. htmlspecialchars_decode()
C. htmlspecialchars()
D. str_replace()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The htmlentities() function is used to convert special characters to HTML entities in PHP.
12. | Which of the following functions is used to convert HTML entities to their corresponding characters in PHP? |
---|
A. htmlentities()
B. htmlspecialchars_decode()
C. htmlspecialchars()
D. str_replace()
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The htmlspecialchars_decode() function is used to convert HTML entities to their corresponding characters in PHP.
13. | Which of the following functions is used to insert a substring into a string at a specified position in PHP? |
---|
A. str_insert()
B. substr_replace()
C. str_replace()
D. str_splice()
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The substr_replace() function is used to insert a substring into a string at a specified position in PHP.
14. | Which of the following functions is used to check if a string contains a specific substring in PHP? |
---|
A. strpos()
B. str_replace()
C. strstr()
D. substr()
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The strstr() function is used to check if a string contains a specific substring in PHP.
15. | Which of the following functions is used to pad a string with a specified character to a certain length in PHP? |
---|
A. str_pad()
B. str_replace()
C. substr()
D. strlen()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The str_pad() function is used to pad a string with a specified character to a certain length in PHP.