note 78480 deleted from reserved.variables by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: doheth.co.uk 

----

slight improvement to the example by 'andres at andresj dot ath dot cx' for determining the path to the currently script.

Previous version:

<?php
// If your script is included from another script:
$included_directory = substr(__FILE__, 0, strrpos(__FILE__, '/'));
?>

Windows uses back-slash to indicate folders, so this didn't work on localhost for me. All you need to do is convert any back-slashes to forward-slashes. This should work on all systems:

<?php
// If your script is included from another script:
$included_file = str_replace('\\', '/', __FILE__);
$included_directory = substr($included_file, 0, strrpos($included_file, '/'));
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.