note 94262 deleted from function.system by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 11:17:59 +0000 |
| Subject: | note 94262 deleted from function.system by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197090@lists.php.net to get a copy of this message | ||
Note Submitter: ca at php dot net dot spamtrak dot org
----
If you don't want the output of your command echoed to STDOUT while using PHP for scripting
(Unix/CLI) use exec() instead of system().
May apply to CGI versions, YMMV.
<?php
$cmd = "date";
$output = system($cmd);
printf("System Output: $output\n");
exec($cmd, $results);
printf("Exec Output: {$results[0]}\n");
/*
Output:
Mon Oct 26 19:30:08 EST 2009
System Output: Mon Oct 26 19:30:08 EST 2009
Exec Output: Mon Oct 26 19:30:08 EST 2009
*/
?>