Trouble with my $ping

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

unts
New php-forum User
New php-forum User
Posts: 2
Joined: Wed Jul 23, 2003 1:07 am
Location: England
Contact:

Trouble with my $ping

Postby unts » Wed Jul 23, 2003 1:14 am

Hi guys, I come here as a n00b, as I'm sure a great many have, in search of your expertise.

I've only just started learning php, and it's the first language I've ever learnt (except html which doesn't count,) and although I'd say I wasn't doing too badly there are, of course, a few stumbling blocks. So, on with the problem.

I'm trying to ping a computer (through the system() command) then store the output of that in the variable "$ping". My problem is that the result of ping, which is something like
"Pinging 192.168.0.1 with 32 bytes of data: Reply from 192.168.0.1: bytes=32 time<1ms TTL=64 Ping statistics for 192.168.0.1: Packets: Sent = 1, Received = 1, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms"
is not being stored as a string. Instead it will store the value 0.

For example, if I set $ping to "Nothing" and the print it, "Nothing" is printed. However on the next line of the script I run the ping command and store it in $ping. Upon printing it now $ping displays "0".

I'm sure it's simple to fix, but I just can't see it!

Thanks guys,
Unts.

unts
New php-forum User
New php-forum User
Posts: 2
Joined: Wed Jul 23, 2003 1:07 am
Location: England
Contact:

Postby unts » Wed Jul 23, 2003 5:01 am

Fixed it!

However I've made a note of this place in case I come across any more problems!


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest

cron