note 24031 deleted from function.system by cmb

From: Date: Sun, 08 Dec 2019 11:46:33 +0000
Subject: note 24031 deleted from function.system by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213483@lists.php.net to get a copy of this message
Note Submitter: n-jones at fredesign dot net ---- To have system output from both the STDERR and STDOUT, I've modified the function posted above by lowery@craiglowery.com function mysystem($command) { if (!($p=popen("($command)2>&1","r"))) { return 126; } while (!feof($p)) { $line=fgets($p,1000); $out .= $line; } pclose($p); return $out; } Now you can use mysystem() like; $var = "cat ".$file; echo mysystem($var); $catfile = mysystem($var); if (ereg("text", $catfile)) { //stuff here; } N.Jones

« previous php.notes (#213483) next »