On 06/14/2011 12:35 PM, Ashley M. Kirchner wrote:
I'm trying to extract data coming from an exec() call. The exec()
call is performing an ncdump on a netCDF file:
?php
$filename = mlab.20110101.cdf;
exec(/usr/bin/ncdump -l 2048 -v wmax .$filename, $output);
echo
On 06/14/2011 01:03 PM, Shawn McKenzie wrote:
$wmax = explode(', ', $output[count($output)-1]);
Should be -2 :(
$wmax = explode(', ', $output[count($output)-2]);
--
Thanks!
-Shawn
http://www.spidean.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
On 6/14/2011 12:03 PM, Shawn McKenzie wrote:
--or to search for wmax =
if($array = preg_grep('/^ wmax = $/', $output)) {
$wmax = explode(', ', $array[0]);
}
array_shift($wmax);
print_r($wmax);
May need some more error checking.
Yeah, error checking ...
Can't search for '/^ wmax
On 06/14/2011 01:30 PM, Ashley M. Kirchner wrote:
if ($array = preg_grep('/^ wmax = /', $output)) {
$array = array_values($array);
$wmax = explode(', ', $array[0]);
}
Sorry, didn't have a way to test when I posted. So you've posted two
different expected outputs and I
On Jun 14, 2011, at 1:30 PM, Ashley M. Kirchner wrote:
On 6/14/2011 12:03 PM, Shawn McKenzie wrote:
--or to search for wmax =
if($array = preg_grep('/^ wmax = $/', $output)) {
$wmax = explode(', ', $array[0]);
}
array_shift($wmax);
print_r($wmax);
May need some more error checking.
5 matches
Mail list logo