Faqts : Computers : Programming : Shopping For You : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

3 of 3 people (100%) answered Yes
Recently 3 of 3 people (100%) answered Yes


When i do this why do i get the file content + 1 retuned : echo include("content/news.txt")? Fix?

Nov 28th, 2008 00:16
healthy man, dman, Alina jane, Articles Hosting, Matthew Walker, Martyn PIttuck,

This is happening because you are misunderstanding how include() works.
You do not need to echo it. How include works is as follows:
You call include("content/news.txt");
PHP makes sure the file exists.
If it does, it turns off PHP parsing mode, and starts reading the file.
Unless it encounters a new PHP script tag, it will just pass the
contents of the file on to the webserver to send to the browser.
The '1' you are getting is the return code of include(), saying that it
succeeded in including the file.
i hope that helps: