I have a code below that checks the ping in MS of a url or IP, but what I need is to get the result's average value inside the array [10]
Example:
Mdia = 74ms
I just wanted the value 74 in a echo
.
Below is a test code
<?php
function pingAddress($ip) {
$pingresult = exec("ping -n 3 $ip", $outcome, $status);
if (0 == $status) {
$status = "alive => ( ".print_r($outcome[10])." )";
} else {
$status = "fora";
}
}
pingAddress("www.google.com");
?>