Запись в переменную результата вывода скрипта

dimardi

Guest
Запись в переменную результата вывода скрипта

Подскажите есть ли возможность в PHP зделать нечто подобное:

$str = require('myscrypt.php') ?
 

zarus

Хитрожопый макак
А чем не нравятся функции? Или это как обычно - ищем трудности там, где их нет?
 

С.

Продвинутый новичок
return()

If called from the global scope, then execution of the current script file is ended. If the current script file was include()ed or require()ed, then control is passed back to the calling file. Furthermore, if the current script file was include()ed, then the value given to return() will be returned as the value of the include() call.
 

dimardi

Guest
спасибки, всеже был бы признателен за пример использования..
 

white phoenix

Новичок
dimardi
parent.php:
PHP:
ob_start();
include "child.php";
$str = ob_get_contents(); // child
ob_end_clean();
child.php:
PHP:
echo "child";
 
Сверху