View Single Post
Old 06-05-2005, 01:52 AM   #2 (permalink)
jaswinder_rana
The Acquainted
 
Join Date: May 2005
Posts: 106
Thanks: 0
jaswinder_rana is on a distinguished road
Default

Include vs readfile
Both are kind of same. The difference is in the speed and time taken for execution. Readfile is more faster than include.

BUT, usage of both are different

test1.php
PHP Code:
<?php
  
echo 'test<br>';
?>
<HTML>
<form>
</form>
</html>

Now if you do
include.php('test1.php'); it'll first execute the PHP, prouce the result and then get the content. so the result will be
Quote:
test
<HTML>
<form>
</form>
</html>
readfile.php('test1.php') will return everything in the file. It'll NOT execute the PHP. so the result will be
Quote:
<?php
echo 'test<br>';
?>
<HTML>
<form>
</form>
</html>

Conclusion
If you want to include static files (with no PHP DYNAMIC CONTENT), use readfile. its more faster.

if you want to include a fie which includes dynamic contents (like test1.php) then use include.
__________________
---------------------------
Errors = Improved Programming.
Portfolio
Send a message via MSN to jaswinder_rana
jaswinder_rana is offline  
Reply With Quote