note 40535 modified in function.popen by danbrown
| From: | danbrown@php.net | Date: | Mon, 02 Mar 2009 13:40:51 +0000 |
| Subject: | note 40535 modified in function.popen by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151336@lists.php.net to get a copy of this message | ||
Yet another workaround for not having bidirectional pipes in php.
<?php
$Cmd =
"bc 2>&1 << END\n" .
"100+221\n" .
"1+3*3\n" .
"quit\n" .
"END\n";
$fp = popen($Cmd, 'r');
$read = fread($fp, 1024);
echo $read;
pclose($fp);
?>
--was--
Yet another workaround for not having bidirectional pipes in php.
$Cmd =
"bc 2>&1 << END\n" .
"100+221\n" .
"1+3*3\n" .
"quit\n" .
"END\n";
$fp = popen($Cmd, 'r');
$read = fread($fp, 1024);
echo $read;
pclose($fp);
http://php.net/manual/en/function.popen.php