A PHP class can have more than one constructor.
- No
- Yes
- Depends on the PHP version
- Only if the class is abstract
In PHP, a class cannot have more than one constructor. The correct option is "No." Unlike some other programming languages, PHP does not support multiple constructors within a single class. However, you can achieve similar functionality by using optional parameters or method overloading. For further details, refer to the PHP documentation on constructors: http://php.net/manual/en/language.oop5.decon.php
Loading...
Related Quiz
- Which of the following are true about the for loop in PHP?
- What is the PHP function to sanitize a string?
- Which of the following are common uses of the $_POST superglobal in PHP?
- Which of the following actions are commonly performed on files in PHP?
- Which of the following is not a magic constant in PHP?