Récupérer les valeurs d'un objet (affiché avec var_dump)
Hi all,
J'ai un problème de récuperation de variable.
En fait, j'effectue via PHP une requête PING grâce à une bibliothèque PEAR, mais là n'est pas le soucis.
Ma fonction me retourne le code suivant, via l'appel à la fonction :
Code:
1 2
| $array_ping = $ping->ping($host);
var_export($array_ping); |
Et voici donc la réponse
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| object(Net_Ping_Result)#2 (11)
{
["_icmp_sequence"]=> array(2)
{
[1]=> float(172) [2]=> float(156)
}
["_target_ip"]=> string(13) "64.233.167.99"
["_bytes_per_request"]=> int(64)
["_bytes_total"]=> int(128)
["_ttl"]=> int(238)
["_raw_data"]=> array(7)
{
[0]=> string(53) "PING google.com (64.233.167.99) 56(84) bytes of data."
[1]=> string(82) "64 bytes from py-in-f99.google.com (64.233.167.99): icmp_seq=1 ttl=238 time=172 ms"
[2]=> string(82) "64 bytes from py-in-f99.google.com (64.233.167.99): icmp_seq=2 ttl=238 time=156 ms"
[3]=> string(0) ""
[4]=> string(34) "--- google.com ping statistics ---"
[5]=> string(61) "2 packets transmitted, 2 received, 0% packet loss, time 999ms"
[6]=> string(55) "rtt min/avg/max/mdev = 156.444/164.719/172.994/8.275 ms"
}
["_sysname"]=> string(5) "linux"
["_round_trip"]=> array(4)
{
["min"]=> float(156.444)
["avg"]=> float(164.719)
["max"]=> float(172.994)
["stddev"]=> float(8.275)
}
["_transmitted"]=> int(2)
["_received"]=> int(2) ["_loss"]=> int(0)
} |
La seule ligne qui m'interesse est
Code:
["_target_ip"]=> string(13) "64.233.167.99"
Mais je ne sais pas comment l'atteindre
Merci de m'aider