View Single Post
Old 06-11-2009, 09:29 AM   #1 (permalink)
Sakakuchi
The Contributor
 
Sakakuchi's Avatar
 
Join Date: Feb 2009
Posts: 64
Thanks: 1
Sakakuchi is on a distinguished road
Default $content = include('file2include.php');

Well I tried something funny some days ago - include a file with include and put it in a variable

file2include.php
PHP Code:
<table>
<tr><td><?php echo 'hello world' ?></td></tr>
</table>
now I include that file like:
PHP Code:
<?php
$content 
= include('file2include.php');

echo 
$content;
?>

Now what I get in the Browser is:

HTML Code:
<table>
<tr><td>Hello World</td></tr>
</table>1
Now I wondered where that 1 comes from? Is it a true which comes since the file was successfully included - and get's converted to a 1?

(This thread is not about - if we should use something like that above or not )
Sakakuchi is offline  
Reply With Quote