a) $obj = new $foo;
b) $obj = new foo;
c) $obj = new foo ()
d) obj = new foo ();
Answer: c
Explanation: To create a new object in PHP we can use the new statement to instantiate a class.
Related Posts
Which of the following method scopes is/are not supported by PHP?
i) private
ii) friendly
iii) static
iv) abstractWhich of the following is/are the right way to declare a method?
i) function functionName() { function body }
ii) scope function functionName() { function body }
iii) method methodName() { method body }
iv) scope method methodName() { method body }Which one of the following is the right way to invoke a method?
Which one of the following is the right way to call a class constant, given that the class is mathFunction?
Which one of the following is the right way to define a constant?
Which one of the following property scopes is not supported by PHP?
The practice of creating objects based on predefined classes is often referred to as ______________
Join The Discussion