note 22058 added to function.exec
| From: | joni dot jarvinen at kolumbus dot fi | Date: | Wed, 05 Jun 2002 07:31:08 +0000 |
| Subject: | note 22058 added to function.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31478@lists.php.net to get a copy of this message | ||
When using 'exec' with 'fortunes' that returns a 'fortune' longer than
one line, the following code solved my problem with it.
<?PHP // index.php
$excuse = array();
exec("fortune /usr/share/games/fortunes/bofh-excuses", $excuse);
for($i = 0; $i <= sizeof($excuse); $i++) {
echo("$excuse[$i]");
}
?>
-- Joni
--
http://www.php.net/manual/en/function.exec.php
http://master.php.net/manage/user-notes.php?action=edit+22058
http://master.php.net/manage/user-notes.php?action=delete+22058
http://master.php.net/manage/user-notes.php?action=reject+22058