$rint1= rtrim($rintydata);
 echo $rint1;
 $rint2= explode(":", $rint1);

The data starts like this (from and email, there are many) ;

 Time: November 9th 2003, 10:37AM - PST
 IP Address: xx.xx.xxx.xxx
 Browser Type: Opera/7.20 (Windows NT 5.1; U)  [en]
 Referer:

The problem is that when I do this ;


while( $res=each($rint2) ) { echo "<br>$res[1]<br>"; };

the colon in Time messes things up.

here is the result ;

Time
November 8th 2003, 07
15PM - PST IP Address
xx.xx.xx.xxx Browser Type
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Referer

when what I really want is ;

Time - November 8th 2003, 07:15PM - PST
IP - Address xx.xx.xx.xxx
Browser Type - Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Referer -

I can't figure out how to do an ereg that will replace just the colon in Time nor can I find a way to make explode ignore it. This may even be a completely wrong approach, any help would be appreciated.

Do you first split the lines? What about a simple strpos and substr?

$colon=strpos(':',$res) will get you the position of only the 1st colon.
then strpos ($res, 0, $colon-1) will get you the 1st part
and strpos ($res, $colon, strlen($res))  the second part.

disclaimers: not tested. not guaranteed to be working. just a suggestion. check the manual to fix it.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to