Research & Documentation 02 Php Net

Research & Documentation 02 Php Net

__LINE__

The __LINE__ magic constant represents the current line number of the file in which it is used. It is useful for debugging or logging purposes, allowing you to track the line number where certain code is executed.

PHP Demo:


__LINE__: 22
            

__FILE__

The __FILE__ magic constant provides the full path and name of the file where it is used. This is helpful for including or requiring files, or for debugging purposes to know the exact file location.

PHP Demo:


__FILE__: /var/www/vhosts/wmoore.bitweb1.nwtc.edu/httpdocs/php/research-documentation/02-php-net.php
            

__DIR__

The __DIR__ magic constant returns the directory of the file where it is used. This is useful for including or requiring files from relative paths, especially when working with multiple directories.

PHP Demo:


__DIR__: /var/www/vhosts/wmoore.bitweb1.nwtc.edu/httpdocs/php/research-documentation
            

__FUNCTION__

The __FUNCTION__ magic constant gives the name of the function where it is used. This can be used for debugging or logging to trace function calls.

PHP Demo:


__FUNCTION__: testFunction
            

Resources