Re: require_once adds a "1"
| From: | James Holden | Date: | Fri, 07 Mar 2003 17:18:42 +0000 |
| Subject: | Re: require_once adds a "1" | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138663@lists.php.net to get a copy of this message | ||
The '1' is received simply because your requirement clause echoed the result to the page.
include, require and include_once all return boolean results of 1 or 0 which indicates a successful loading of said include. If you want to suppress the output of an include use ob_ methods which prevent output the stdout.
Simply putting 'include_once("anyfile.php")' will output whatever processes occur within that include. Putting the echo statement will additionally output the status of the include operation.
Regards,
Jim
londontown.com
Ernest E Vogelsinger wrote:
At 17:28 07.03.2003, Gary spoke out and said: --------------------[snip]--------------------Hi I've included the following in a php document: <?php echo @ require_once("anyfile.php") and it works exactly as I expect except at the end of the included document theres a single "1" displayed. I've noticed also that if I include a document in the included document the end result will be the document I want exactly as I want it with the addition of two ones "11"s can anyone tell me how to get rid of the ones? (if I run anyfile.php by itself there are no "1"s)--------------------[snip]-------------------- This happens if the included file returns some value, in your case it seems to return "true". Remove the return <something> statement (you may simply "return;" if necessary) and the 1 will be history.