diff --git a/php.md b/php.md index 0c5370f..80199d1 100644 --- a/php.md +++ b/php.md @@ -148,7 +148,7 @@ See: [Functions](#functions-3) ### Constants ```php -define("MY_CONST", "hello"); +const MY_CONST = "hello"; echo MY_CONST; # => hello @@ -157,6 +157,20 @@ echo 'MY_CONST is: ' . MY_CONST; ``` + +### Runtime defined Constants +```php +define("CURRENT_DATE", date('Y-m-d')); + +// One possible representation +echo CURRENT_DATE; # => 2021-01-05 + +# => CURRENT_DATE is: 2021-01-05 +echo 'CURRENT_DATE is: ' . CURRENT_DATE; +``` + + + ### Classes ```php class Student {