Re: ereg_replace()

From: Date: Thu, 15 Aug 2002 05:15:24 +0000
Subject: Re: ereg_replace()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-112690@lists.php.net to get a copy of this message
I'd do something like this: $str = " User : liam@i-redlands.net Dir : /home/eXtremail/mbox/i-redlands.net/3/1/liam Forward : Copy : Account mapping : User Disk Quota : 0 Disk Space Used : 0 Max In Mail Size : 0 Max Out Mail Size : 0 Autoreply : No Mailbox Access : POP,IMAP Created : Sat Jul 6 09:21:23 2002 Status : Enabled "; $ary = explode("\n", $str); foreach( $ary as $line ) { list($k, $v) = split(" : ", $line); $data[$k] = $v; } print($data["User Disk Quota"] . "\n"); print($data["Dir"] . "\n"); On Thu, 15 Aug 2002, Liam MacKenzie wrote: > Hi guys, > > I'm looking to get a specific bit of data out of a slightly complex amount > of data. > Ok, I have this in a variable: > > User : liam@i-redlands.net > Dir : /home/eXtremail/mbox/i-redlands.net/3/1/liam > Forward : > Copy : > Account mapping : > User Disk Quota : 0 > Disk Space Used : 0 > Max In Mail Size : 0 > Max Out Mail Size : 0 > Autoreply : No > Mailbox Access : POP,IMAP > Created : Sat Jul 6 09:21:23 2002 > Status : Enabled > > > This is different for every user as you can see. For instance, the Dir is > different for everyone, such is the Created date. > I need to extract the User Disk Quota and the Disk Space Used variables out > of this. How would I go about doing that? > > Is there an easier function to use than ereg_replace? > > Thanks in advance! > Liam > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#112690) next »