Web Development With PHP
Web Development With PHP - Important Points
26. | Which PHP function is used to check if a file exists? |
---|
A. file_exists()
B. check_file()
C. exists_file()
D. file_check()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The file_exists() function is used to check if a file exists in PHP.
27. | Which PHP function is used to remove whitespace from the beginning and end of a string? |
---|
A. trim()
B. rtrim()
C. ltrim()
D. strip()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The trim() function is used to remove whitespace from the beginning and end of a string in PHP.
28. | Which of the following is NOT a valid way to declare a variable in PHP? |
---|
A. $variable = "value";
B. var $variable = "value";
C. $variable = array("value1", "value2");
D. $variable = 123;
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The var keyword is not used to declare variables in PHP. Instead, variables are declared using a $ followed by the variable name.
29. | Which PHP function is used to get the current date and time? |
---|
A. time()
B. date()
C. datetime()
D. now()
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The date() function is used to get the current date and time in PHP.