note 110174 added to function.basename
| From: | erelsgl at gmail dot com | Date: | Wed, 26 Sep 2012 17:44:57 +0000 |
| Subject: | note 110174 added to function.basename | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191033@lists.php.net to get a copy of this message | ||
Here is a simple way to add a unit-test at the bottom of your library files:
<?php
// your library functions
if (basename(__FILE__)==basename($_SERVER['PHP_SELF'])) {
// your unit test
}
?>
When the library is included in another file, the whole unit-test section will be ignored. It will
be activated only when you point your browser to the library file.
----
Server IP: 69.147.83.199
Probable Submitter: 85.130.218.41
----
Manual Page -- http://www.php.net/manual/en/function.basename.php
Edit -- https://master.php.net/note/edit/110174
Del: integrated -- https://master.php.net/note/delete/110174/integrated
Del: useless -- https://master.php.net/note/delete/110174/useless
Del: bad code -- https://master.php.net/note/delete/110174/bad+code
Del: spam -- https://master.php.net/note/delete/110174/spam
Del: non-english -- https://master.php.net/note/delete/110174/non-english
Del: in docs -- https://master.php.net/note/delete/110174/in+docs
Del: other reasons-- https://master.php.net/note/delete/110174
Reject -- https://master.php.net/note/reject/110174
Search -- https://master.php.net/manage/user-notes.php