- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
PHP Magic Constants | Php magic constants list | Php magic constants examples
Php magic constants list
Php magic constants examples
Php magic constants w3schools
Magic constant in PHP with Example
PHP magic methods
PHP constants
Predefined constants in PHP
Magic constant in magic square
PHP Magic Constants
PHP Predefined Constants
PHP has nine predefined constants that change value depending on where they are used, and therefor they are called "magic constants".
These magic constants are written with a double underscore at the start and the end, except for the ClassName::class constant.
Magic Constants
Here are the magic constants, with descriptions and examples:
Constant Description
__CLASS__ If used inside a class, the class name is returned.
__DIR__ The directory of the file.
__FILE__ The file name including the full path.
__FUNCTION__ If inside a function, the function name is returned.
__LINE__ The current line number.
__METHOD__ If used inside a function that belongs to a class, both class and function name is returned.
__NAMESPACE__ If used inside a namespace, the name of the namespace is returned.
__TRAIT__ If used inside a trait, the trait name is returned.
ClassName::class Returns the name of the specified class and the name of the namespace, if any.
Note:
The magic constants are case-insensitive, meaning __LINE__ returns the same as __line__.
class Fruits {
public function myValue(){
return __CLASS__;
}
}
$kiwi = new Fruits();
echo __DIR__;
echo __FILE__;
function myValue2(){
return __FUNCTION__;
}
echo myValue2();
echo __LINE__;
class Fruits2 {
public function myValue2(){
return __METHOD__;
}
}
$kiwi2 = new Fruits2();
namespace myArea3;
function myValue3(){
return __NAMESPACE__;
}
echo myValue3();
trait message1 {
public function msg1() {
echo __TRAIT__;
}
}
class Welcome {
use message1;
}
$obj = new Welcome();
#magic #magicconstant #php #laravel #classes #coding #htmlcolor #javascript #jquery #tutorial
Видео PHP Magic Constants | Php magic constants list | Php magic constants examples канала Rn Software Programming
Php magic constants examples
Php magic constants w3schools
Magic constant in PHP with Example
PHP magic methods
PHP constants
Predefined constants in PHP
Magic constant in magic square
PHP Magic Constants
PHP Predefined Constants
PHP has nine predefined constants that change value depending on where they are used, and therefor they are called "magic constants".
These magic constants are written with a double underscore at the start and the end, except for the ClassName::class constant.
Magic Constants
Here are the magic constants, with descriptions and examples:
Constant Description
__CLASS__ If used inside a class, the class name is returned.
__DIR__ The directory of the file.
__FILE__ The file name including the full path.
__FUNCTION__ If inside a function, the function name is returned.
__LINE__ The current line number.
__METHOD__ If used inside a function that belongs to a class, both class and function name is returned.
__NAMESPACE__ If used inside a namespace, the name of the namespace is returned.
__TRAIT__ If used inside a trait, the trait name is returned.
ClassName::class Returns the name of the specified class and the name of the namespace, if any.
Note:
The magic constants are case-insensitive, meaning __LINE__ returns the same as __line__.
class Fruits {
public function myValue(){
return __CLASS__;
}
}
$kiwi = new Fruits();
echo __DIR__;
echo __FILE__;
function myValue2(){
return __FUNCTION__;
}
echo myValue2();
echo __LINE__;
class Fruits2 {
public function myValue2(){
return __METHOD__;
}
}
$kiwi2 = new Fruits2();
namespace myArea3;
function myValue3(){
return __NAMESPACE__;
}
echo myValue3();
trait message1 {
public function msg1() {
echo __TRAIT__;
}
}
class Welcome {
use message1;
}
$obj = new Welcome();
#magic #magicconstant #php #laravel #classes #coding #htmlcolor #javascript #jquery #tutorial
Видео PHP Magic Constants | Php magic constants list | Php magic constants examples канала Rn Software Programming
Комментарии отсутствуют
Информация о видео
22 сентября 2024 г. 18:44:02
00:11:43
Другие видео канала





















