Sessions and included files

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 7
Joined: Mon Mar 12, 2018 9:26 am

Mon May 14, 2018 9:10 am

Beginner question here: if I include a file in another script, is it necessary to repeat session commands? I'm thinking along these lines:


include 'myfunction.php';

<rest of script>

Does myfunction.php need the session_start() command to use the $_SESSION array in use by the parent function?


php-forum Fan User
php-forum Fan User
Posts: 584
Joined: Fri Apr 01, 2016 2:18 am

Mon May 14, 2018 9:23 am

Why don't you try yourself? Make a test case which leads to different results. And have a look at the manual again for what include does.

Post Reply