PHP

research-documentation 02-phpnet

PHP.NET | Magic Constants

__LINE__

The __LINE__ magic constant returns the value of the line the constant is placed on. For example, this line in the text editor is number 8, so the number 9 should appear below.

14

__FILE__

The __FILE__ magic constant returns the complete file path from the server of the current file you are looking at.

/home/dh_u7w823/aallenprojects.me/wp-content/school-archives/php/research-documentation/02-phpnet.php

__DIR__

The __DIR__ magic constant functions similarly to __FILE__, but returns the directory of the file instead. __DIR__ also takes into consideration the potential use of includes.

/home/dh_u7w823/aallenprojects.me/wp-content/school-archives/php/research-documentation

__FUNCTION__

The __FUNCTION__ magic constant returns the name of the function if the constant is inside of a function. In this case, there is a __FUNCTION__ constant underneath this line in the text editor, but there it is not inside of a function.

Resources