Jump to content

including a file within a function


Zaid

Recommended Posts

what's the difference between including a file inside and outside a function?

I want the variables of the included files to work directly without passing them again to the function

my code is not working when the file is included inside the function e.g.

 

<?

function testing ()
{
include( 'include/session.php' );
echo $session->username;
}

testing();

?>

 

any ideas? or suggestion to an alternative method?

Link to comment
https://forums.phpfreaks.com/topic/45043-including-a-file-within-a-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.