constructor in require/include functions
Posted: Sun Jul 22, 2007 11:08 pm
There is a constructor that execute first before require/include function? like __constructor in class...
purpose:
I want to call a function inside the phpfile.php before or upon execution of require('phpfile.php'); to load all the initial variables needed by all php file.
purpose:
I want to call a function inside the phpfile.php before or upon execution of require('phpfile.php'); to load all the initial variables needed by all php file.
Code: Select all
<?php
//phpfile.php
function constructorfunc (){
const(WORKINGFOLDER, "c:");
//.....................
}
?>
<?php
//test.php
require('phpfile.php');
echo WORKINGFOLDER;
?>