Last active
April 14, 2021 07:23
-
-
Save minte9/21894b8a442f6677a98347b970fd566a to your computer and use it in GitHub Desktop.
Php / Basics / Constants - https://www.minte9.com/php/basics-constants-23
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 getMaxValue() method | |
* Use static syntax | |
*/ | |
class MyClass { | |
const MAX_VALUE = 100; | |
/** | |
* SOLUTION | |
*/ | |
public static function getMaxValue() { | |
return self::MAX_VALUE; | |
} | |
} | |
echo MyClass::getMaxValue(); // 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment