note 114870 added to function.shell-exec
| From: | xxxpaul1104xxx at gmail dot com | Date: | Fri, 18 Apr 2014 03:43:54 +0000 |
| Subject: | note 114870 added to function.shell-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199288@lists.php.net to get a copy of this message | ||
//wish this could help for handle the shell_exec() output strings where "\n" that looks
like a " " space.
//ex:
$configPath = "/home/somewhere";
$configList = shell_exec("ls $configPath/123.*.cfg"); // output is
"/home/somewhere/123.111.cfg /home/somewhere/123.112.cfg"
// there looks like a "space" between output strings, but that's a "\n"
actually.
$nodeList =
trim(str_replace("\n",",",str_replace("$configPath/","",str_replace(".cfg","",$configList))));
// get "123.111,123.112"
----
Server IP: 123.204.228.176
Probable Submitter: 139.175.168.251
----
Manual Page -- http://php.net/manual/en/function.shell-exec.php
Edit -- https://master.php.net/note/edit/114870
Del: integrated -- https://master.php.net/note/delete/114870/integrated
Del: useless -- https://master.php.net/note/delete/114870/useless
Del: bad code -- https://master.php.net/note/delete/114870/bad+code
Del: spam -- https://master.php.net/note/delete/114870/spam
Del: non-english -- https://master.php.net/note/delete/114870/non-english
Del: in docs -- https://master.php.net/note/delete/114870/in+docs
Del: other reasons-- https://master.php.net/note/delete/114870
Reject -- https://master.php.net/note/reject/114870
Search -- https://master.php.net/manage/user-notes.php