note 67354 added to function.include
| From: | julien dot sebire at free dot fr | Date: | Wed, 07 Jun 2006 12:57:17 +0000 |
| Subject: | note 67354 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-113536@lists.php.net to get a copy of this message | ||
When trying to return a value from a remotely included php file, I spent a little time to figure out
what it should produce.
The english documentation says :
"You can take the value of the include call as you would a normal function. This is not,
however, possible when including remote files unless _the output_ of the remote file has valid PHP
start and end tags (as with any local file)."
The french translation says something like :
"You can take the value of the include call as you would a normal function. This is not,
however, possible when including remote files unless the remote file has valid PHP start and end
tags (as with any local file)."
That means this remotely included file will work :
<?php
$var=array(1,2);
print('<?php return '.var_export($var,true).'; ?>');
?>
=> returns :
Array
{
[0] => 1
[1] => 2
}
While this one, suggested by the french documentation, won't work :
<?php
$var=array(1,2);
return $var;
?>
=> returns :
1 (include succeed but no value returned)
Hope this can help and maybe edit the french translation.
----
Server IP: 195.26.5.2
Probable Submitter: 83.99.49.205
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- http://master.php.net/note/edit/67354
Del: integrated -- http://master.php.net/note/delete/67354/integrated
Del: useless -- http://master.php.net/note/delete/67354/useless
Del: bad code -- http://master.php.net/note/delete/67354/bad+code
Del: spam -- http://master.php.net/note/delete/67354/spam
Del: non-english -- http://master.php.net/note/delete/67354/non-english
Del: in docs -- http://master.php.net/note/delete/67354/in+docs
Del: other reasons-- http://master.php.net/note/delete/67354
Reject -- http://master.php.net/note/reject/67354
Search -- http://master.php.net/manage/user-notes.php