text formatting using eregi_replace
From: David (jaco2001uk_at_dontspamme.ntlworld.com)
Date: 11/28/03
- Next message: Nikolai Chuvakhin: "Re: php evaluated directly by mysql and not the webserver ?"
- Previous message: Pedro Graca: "Re: objects... asp does... php doesn't"
- Next in thread: Pedro Graca: "Re: text formatting using eregi_replace"
- Reply: Pedro Graca: "Re: text formatting using eregi_replace"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 28 Nov 2003 22:44:49 -0000
Hi,
I've had a search through google but couldn't really find the answer I was
looking for.I'm
new to PHP, so please take it <relatively> easy.
I've created a script which runs some SNMP queries. I'd like help if
possible in formatting one of the
values it returns.
When you run a query for the system uptime the result is displayed like so:
Timeticks: (4592345) 12:45:23.45
1.) I would like to remove the first two "fields" so I am left with:
12:45:23.45
I have managed to remove the Timeticks: part but don't know how to remove
the (4592345) (because this is of variable size).
$sysuptime = eregi_replace("Timeticks: ","",$sysuptime);
I don't know if it is possible but could you say remove everything within
the brackets - is that possible in a regular expression?
$sysuptime = eregi_replace("[()]","",$sysuptime); ???? (I tried that and it
didn't work ;) )
2.) If possible I would like to convert the output 12:45:23.45 to something
more like 12hr 45 mins
Obviously as the uptime increases that needs to incorporate _days_ as well.
3. Is it good/bad practice to use the same variable name twice in the
statement above?
Many thanks
David
- Next message: Nikolai Chuvakhin: "Re: php evaluated directly by mysql and not the webserver ?"
- Previous message: Pedro Graca: "Re: objects... asp does... php doesn't"
- Next in thread: Pedro Graca: "Re: text formatting using eregi_replace"
- Reply: Pedro Graca: "Re: text formatting using eregi_replace"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|