Is it possible to encapsulate, a variable or function let say, in PHP without wrapping them in a class? What I was doing is:
//Include the file containing the class which contains the variable or function include('SomePage.php'); //Instantiate the class from "SomePage.php" $NewObject = new SomeClassFromSomePage(); //Use the function or variable echo $NewObject->SomeFuncFromSomeClass(); echo $NewObject->SomeVarFromSomeClass; My intention is to avoid naming conflict. This routine, although it works, makes me tired. If I cannot do it without class, it is possible not to instantiate a class? and just use the variable or function instantly?
$xin main page and the included page.