note 120846 added to function.include-once

From: Date: Tue, 21 Mar 2017 13:39:59 +0000
Subject: note 120846 added to function.include-once
Groups: php.notes 
Request: Send a blank email to php-notes+get-208937@lists.php.net to get a copy of this message
i tried -------------------------------- index.php: $out='todo 1'; include 'file1.php'; $out='todo 2'; include 'file1.php'; echo 'end'; -------------------------------- file1.php: include_once 'file2.php'; if(isset($out)){ echo $out; } -------------------------------- file2.php: $out='first todo once'; include 'file.php'; the output is: first todo once first todo once todo 2 what should i do? if i would replace in file2.php include with include_once, then i have following output: first todo once todo 2 i could write $out='first todo once'; include 'file1.php' $out='todo 1'; include 'file1.php'; $out='todo 2'; include 'file1.php'; but i don't want :-) please help ---- Server IP: 72.52.91.14 Probable Submitter: 185.17.207.213 ---- Manual Page -- http://php.net/manual/en/function.include-once.php Edit -- https://master.php.net/note/edit/120846 Del: integrated -- https://master.php.net/note/delete/120846/integrated Del: useless -- https://master.php.net/note/delete/120846/useless Del: bad code -- https://master.php.net/note/delete/120846/bad+code Del: spam -- https://master.php.net/note/delete/120846/spam Del: non-english -- https://master.php.net/note/delete/120846/non-english Del: in docs -- https://master.php.net/note/delete/120846/in+docs Del: other reasons-- https://master.php.net/note/delete/120846 Reject -- https://master.php.net/note/reject/120846 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#208937) next »