...

View Full Version : how to get usefel data from string



graziano
11-30-2006, 10:56 AM
Hello

I wish to get from

$uptime = "05:54:13 up 1:54, 2 users, load average: 0.60, 0.47, 0.40";

only the first value of load average , 0.60

Anyone can help me ?

anarchy3200
11-30-2006, 01:01 PM
Untested but should do the job:



$uptime = "05:54:13 up 1:54, 2 users, load average: 0.60, 0.47, 0.40";
$uptime_vars = explode(',', $uptime);

print $load_average = substr(trim($uptime_vars), 14, 4);

You may have to change the 14 in the substr if i miscounted but that shouldn't be far off.

Hope this helps.

graziano
11-30-2006, 01:40 PM
Thank you



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum