I want some functions to be not visible when required
, but visible in the script they belong to.
For example:
required.php:
<?php
function privateFunction() {
echo 'from private function\n';
}
echo 'from required.php: ';
privateFunction();
index.php:
<?php
require './required.php';
echo 'from index.php: ';
privateFunction(); // I want this to give an error like "private function called outside the script it has been declared".
I have already tried making the function private
, but it only gives a parse error.