PHP Syntax
16. | Which of the following is used to call a method of an object in PHP? |
---|
A. object_name.method_name();
B. call object_name.method_name();
C. object_name(call method_name());
D. object_name->method_name();
View Answer Discuss Work SpaceAnswer: option a
Explanation:
object_name.method_name(); is used to call a method of an object in PHP.
17. | Which of the following is used to check if a variable is null in PHP? |
---|
A. is_null($variable)
B. $variable == null
C. $variable === null
D. all of the above
View Answer Discuss Work SpaceAnswer: option d
Explanation:
all of the above are correct ways to check if a variable is null in PHP.
18. | Which of the following is used to check if a variable is set in PHP? |
---|
A. isset($variable)
B. $variable is set
C. $variable set
D. all of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
isset($variable) is used to check if a variable is set in PHP.
19. | Which of the following is used to execute a block of code only if a condition is true in PHP? |
---|
A. if statement
B. switch statement
C. for loop
D. while loop
View Answer Discuss Work SpaceAnswer: option a
Explanation:
if statement is used to execute a block of code only if a condition is true in PHP.
20. | Which of the following is used to execute a block of code repeatedly as long as a condition is true in PHP? |
---|
A. if statement
B. switch statement
C. for loop
D. while loop
View Answer Discuss Work SpaceAnswer: option d
Explanation:
while loop is used to execute a block of code repeatedly as long as a condition is true in PHP.