note 95714 added to function.include

From: Date: Mon, 18 Jan 2010 00:06:01 +0000
Subject: note 95714 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-165059@lists.php.net to get a copy of this message
This happens with PHP 5.2.8 - very strange behaviour: <?php include_once $_SERVER['DOCUMENT_ROOT'].'/incl_file.php'; ?> works as needed. On the contrary: <?php function doIt() { include $_SERVER['DOCUMENT_ROOT'].'/incl_file.php'; } doIt(); ?> does not find the file. Everything works using the function syntax instead of the construct syntax: <?php function doIt() { include($_SERVER['DOCUMENT_ROOT'].'/incl_file.php'); } doIt(); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 151.47.209.89 ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- https://master.php.net/note/edit/95714 Del: integrated -- https://master.php.net/note/delete/95714/integrated Del: useless -- https://master.php.net/note/delete/95714/useless Del: bad code -- https://master.php.net/note/delete/95714/bad+code Del: spam -- https://master.php.net/note/delete/95714/spam Del: non-english -- https://master.php.net/note/delete/95714/non-english Del: in docs -- https://master.php.net/note/delete/95714/in+docs Del: other reasons-- https://master.php.net/note/delete/95714 Reject -- https://master.php.net/note/reject/95714 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#165059) next »