note 97173 added to function.passthru
| From: | ignaciopazposse at osu1 dot php dot net | Date: | Tue, 06 Apr 2010 14:15:00 +0000 |
| Subject: | note 97173 added to function.passthru | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167727@lists.php.net to get a copy of this message | ||
I'd like to refer about the use of use of passthru as a substitute to include or require which
I didn't see before. It helped me to workaround a problem with a script which fatally failed
only when included or required. I presume that it had to be with recursive includes because there
where memory exhaustion messages that didn't get fixed even when increasing the memory limit
with ini_set(). As I had no time to re-code it, the fix of the problem was to get the output of the
script via a passthru call.
Something like this:
<?php
# ...
# (function stuff)
ob_start();
passthru("php myscript.php, $result");
$content_grabbed=ob_get_contents();
ob_end_clean();
if($result=0){
echo '<div>',$content_grabbed,'</div>';
}_
# (more function stuff)
# ...
?>
I don't know about drawbacks that this method might have. Maybe and increased overhead? Anyway
I was happy to circumvent the problem with it.
----
Server IP: 69.147.83.197
Probable Submitter: 190.113.137.38
----
Manual Page -- http://www.php.net/manual/en/function.passthru.php
Edit -- https://master.php.net/note/edit/97173
Del: integrated -- https://master.php.net/note/delete/97173/integrated
Del: useless -- https://master.php.net/note/delete/97173/useless
Del: bad code -- https://master.php.net/note/delete/97173/bad+code
Del: spam -- https://master.php.net/note/delete/97173/spam
Del: non-english -- https://master.php.net/note/delete/97173/non-english
Del: in docs -- https://master.php.net/note/delete/97173/in+docs
Del: other reasons-- https://master.php.net/note/delete/97173
Reject -- https://master.php.net/note/reject/97173
Search -- https://master.php.net/manage/user-notes.php