Include vs. Header

From: Date: Fri, 06 Oct 2000 23:48:57 +0000
Subject: Include vs. Header
Groups: php.general 
Request: Send a blank email to php-general+get-19005@lists.php.net to get a copy of this message
Hi, guys! I'd wanna ask you a trivial question and I don't have a firm idea even after referencing to the php.net's doc. I basically want to know the differences and usages of include() and header() (and require()). When I was working with PHP 2.x, I always (and only) used include() & exit() combi to move on to the next page. It feels like I have some limitation when doing so in PHP 4. Is that true especially when I introduce the cookie function, or am I just dreaming? Here's a very simple scenario: In test.php: <?php $myvar = 2; include ("test.html"); exit(); ?> In test.html: <html><head><title></title></head> <body> 1 <?php echo $myvar> 3</body></html> Result: 1 2 3 - - - - - whereas - - - - - In test.php: <?php $myvar = 2; header ("Location: test.html"); exit(); ?> In test.html: <html><head><title></title></head> <body> 1 <?php echo $myvar> 3</body></html> Result: 1 3 You think it's PHP config. issue? I'd appreciate for your help!!!

« previous php.general (#19005) next »