02 Php Net Home

02 Php Net Home

LINE

Out of the 4 listed, this is the only one that relies on position in the file because, well, it returns the line number. Also, it counts blank lines in the final value.

Example: 10

FILE

FILE not only returns the name of the file, but it also returns the full path to it. Since it returns the executed file, included file info would be returned instead of whatever file the include statement was called in.

Example: /var/www/vhosts/aehmann.bitweb1.nwtc.edu/httpdocs/php/research-documentation/02-php-net/include-example.php

DIR

If you only need the path and not the file name, DIR can be used. Like FILE, it returns info about whatever file it runs in. Also, a trailing slash only gets applied if in the root directory.

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

FUNCTION

If inside a function, this returns the name of that function. If the function is anonymous, it returns {closure}. If it's not in a function, it returns nothing.

Example: func

Resources