I'd do something like this:
$str = "
User : [EMAIL PROTECTED]
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 : [EMAIL PROTECTED]
> 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
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php