Re: object oriented syntax in php
| From: | Robin Vickery | Date: | Tue, 28 Mar 2006 10:40:28 +0000 |
| Subject: | Re: object oriented syntax in php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-232724@lists.php.net to get a copy of this message | ||
On 28/03/06, Merlin <news.groups@web.de> wrote:
> Hi there,
>
> I do have problems with object oriented syntax as this is not familar to me.
> There is following output:
>
>
> Now I would like to retrieve my needed info out of it. How do I do this? (sounds
> a bit silly this question, sorry :-)
>
> I tried:
> $ping_result = $ping->ping('php.net');
> echo $ping_result["net_ping_result"]["_raw_data"][5];
You'd be much better using the interface to Net_Ping_Result that's
provided. Then your code won't break if someone decides to rearrange
the internals of the class.
$ping_result->getMin();
$ping_result->getMax();
$ping_result->getAvg();
$ping_result ->getTransmitted();
$ping_result->getReceived();
$ping_result->getLoss();
...
-robin