Search notes:

PHP code snippets: __FILE__, __LINE__ and __DIR__

__FILE__ expands to name of the file where this identifier occurs, __DIR__ to its directory name and __LINE__ to the line number.
<html>
<head><title>__LINE__ __FILE__ __DIR__</title></head>
  <style type="text/css">
    tr {vertical-align: top}
    td:nth-child(2) {width:40%} /* Path should not be broken on two lines except on small monitors. */
  </style>
<body>

  <table border=1>
    <tr><td>__LINE__</td><td><?php echo __LINE__ ?></td><td>&nbsp;</td></tr>
    <tr><td>__FILE__</td><td><?php echo __FILE__ ?></td><td>Compare with <a href='_SERVER.html'><code>$_SERVER['SCRIPT_FILENAME']</code></a>. Especially windows
                                                            uses backslashes in <code>__FILE__</code> while <code>$_SERVER['SCRIPT_FILENAME']</code> uses 
                                                            forward slashes.</td></tr>
    <tr><td>__DIR__ </td><td><?php echo __DIR__  ?></td><td>&nbsp;</td></tr>
  </table>

</body>
</html>
Github repository about-php, path: /__LINE__FILE__DIR__.html

See also

The predefined preprocessor macros __FUNCTION__, __FILE__ and __LINE__ in C and C++.
$_SERVER['SCRIPT_FILENAME'

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1740100794, '18.117.136.5', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/web/php/snippets/__LINE-FILE-DIR__(61): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78