note 46485 added to function.include-once

From: Date: Wed, 13 Oct 2004 02:05:39 +0000
Subject: note 46485 added to function.include-once
Groups: php.notes 
Request: Send a blank email to php-notes+get-78462@lists.php.net to get a copy of this message
a simple sample can see the difference between include and include_once: -----Included file (ss-1.php): <?php $ii = $i; ?> -----Main file (ss.php): <?php for ($i = 0; $i <= 4; $i++) { include_once "ss-1.php"; echo $ii; } ?> Here, you get "00000" as the result. And you will get "01234" when you change the above "include_once" to "include". So, remember don't use "include_once" in such a loop if you want to store some variables in a seperated file. ---- Manual Page -- http://www.php.net/manual/en/function.include-once.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46485 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46485&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46485&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46485&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46485&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46485&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46485&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+46485&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#78462) next »