Last active
April 14, 2021 07:26
-
-
Save minte9/777ff1880bd48985bbee314242dc8f31 to your computer and use it in GitHub Desktop.
Php / OOP / Constructor - https://www.minte9.com/php/oop-class-constructor-122
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Define class constructor and ... | |
* Display the constructor method name | |
*/ | |
$obj = new A(); | |
class A | |
{ | |
/** | |
* SOLUTION | |
*/ | |
function __construct() | |
{ | |
echo __METHOD__; // A::__construct | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment