PHP magic constants in action
Автор: PHP Explained
Загружено: 2025-06-06
Просмотров: 84
Описание:
PHP Magic constants are predefined constants that change value depending on where they are used.
There are 9 magic constants. Magic constants are started and ended with double underscore, except constant ClassName::class.
Here are 9 magic constants with their description.
1. _CLASS_
If used inside a class, the class name is returned.
2. _DIR_
The directory of the file is returned.
3. _FILE_
The file name including the full path is returned.
4. _FUNCTION_
If inside a function, the function name is returned.
5. _LINE_
The current line number is returned.
6. _METHOD_
If used inside a function that belongs to a class, both class and function name is returned.
7. _NAMESPACE_
If used inside a namespace, the name of the namespace is returned.
8. _TRAIT_
If used inside a trait, the trait name is returned.
9. ClassName::class
Returns the name of the specified class and the name of the namespace, if any.
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: