session_start()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

session_start()

Post by Ree »

Is it fine to use any statements (that don't output anything) BEFORE using session_start(), such as this:

Code: Select all

<?php

define('path', 'value');
include(path . '/file.php');

session_start();

$_SESSION['msg'] = 'Is that ok?';

?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

so long as there is no output, yes.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

yes. as long as nothing is outputted to the browser first, not even a blank space

edit: im too slow :-(
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

Good then.

off-topic: feyd, you're alive answering machine :D. If you see orange feyd name as an online user, you can almost 100% be sure you'll get the answer in no time. You're doing a great job, really.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

thanks.. too bad I don't get paid for it. :P
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

i'm telling you.i sit online praying i can beat him to hte punch. :)
Post Reply