Re: How to strip extra characters off of a string

From: Date: Thu, 09 Jan 2003 02:38:54 +0000
Subject: Re: How to strip extra characters off of a string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-130853@lists.php.net to get a copy of this message
rdkurth@starband.net wrote:
I need to be able to just extract the number that is right Under blocks in this example it is the number 57070. This was generated by the quota -g groupname command. Disk quotas for group site53 (gid 165):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
      /dev/hda4   57070  307201  307200            1146       0       0 
I have tried using some of the string functions like I used $test=strstr ($test, "hda"); $test= substr("$test",7);
Have a look at explode(). You could do something like this: $test=strstr ($test, "hda"); $test= substr("$test",7); $aValues = explode(" ", $test); list($fs, $blocks, $quota, $limit, $rest_of_string) = each ($aValues, 4); Jc

« previous php.general (#130853) next »