php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #23766 include/require that return
Submitted: 2003-05-22 20:39 UTC Modified: 2003-05-22 20:42 UTC
From: ericn at ionws dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.3.1 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ericn at ionws dot com
New email:
PHP Version: OS:

 

 [2003-05-22 20:39 UTC] ericn at ionws dot com
Currently (obviously), include(_once) and require(_once) process the php file that they are called with and output of that file is sent.  However, it would be useful to store an included file's output in a variable instead of sending it to the user.  For example:

include.php:
<?php echo "<b>Bold Text</b>"; ?>

include("include.php");
would send <b>Bold Text</b> to the user, however, the hypothetical function (or construct) includeto would store all of include.php's output in a variable.  So:

$output = includeto("include.php");

$output would contain "<b>Bold Text</b>"

If there is already a way to accomplish this, I apologise, but could not find one.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-22 20:42 UTC] rasmus@php.net
ob_start()
include 'foo.php';
$foo = ob_get_contents();
ob_end_clean();
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Jun 16 06:00:01 2026 UTC