Are Parent constructors called implicitly inside a class constructor?
- Yes
- No
- Depends on the scenario
- Only in abstract classes
Parent constructors are not called implicitly inside a class constructor in PHP. You need to explicitly call the parent constructor using parent::__construct(). Learn more: http://php.net/manual/en/language.oop5.decon.php
Loading...
Related Quiz
- You want to check if a certain constant has been defined in your PHP script. How would you do this?
- How is the ternary conditional operator used in PHP?
- The PHP $_SESSION superglobal is used to store information about a user session.
- The default keyword in a PHP switch statement is optional.
- You need to retrieve the error message after an FTP operation fails in your PHP script. How would you do this?