PHP Functions
PHP Functions - Important Points
1. | Which of the following is a built-in PHP function that returns the length of a string? |
---|
A. strlen()
B. str_length()
C. stringlen()
D. strsize()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The strlen() function returns the length of a string in PHP.
2. | Which PHP function is used to create an array? |
---|
A. array()
B. create_array()
C. make_array()
D. build_array()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The array() function is used to create an array in PHP.
3. | Which PHP function is used to generate a random number? |
---|
A. rand()
B. random()
C. random_num()
D. gen_num()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The rand() function is used to generate a random number in PHP.
4. | Which PHP function is used to convert a string to uppercase? |
---|
A. strtoupper()
B. to_uppercase()
C. upper()
D. convert_upper()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The strtoupper() function is used to convert a string to uppercase in PHP.
5. | Which PHP function is used to get the current date and time? |
---|
A. date()
B. time()
C. now()
D. datetime()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The date() function is used to get the current date and time in PHP.