[PHP] Re: sorting a list using regex

2002-06-05 Thread Joshua E Minnie

I am trying to sort a list by their first character, my problem comes when
that first character is a number.  When the character is a number I should
be able to display just the values which begin with a number.  When the
value is a letter, I have no problem sorting this out.  Here is the code
that I am using to determine that, any help will be greatly appreciated.

?
[snip]
while(!feof($fp)) {
  $artist = fgetcsv($fp,1024,:);
  if(isset($_GET[sort])) {
if(($_GET[sort] != substr(strtoupper($artist[0]),0,1)) 
!($_GET[sort] == #  ereg(^[0-9],$artist[0]))) continue;
  }
}
[snip]
?

Running PHP 4.2.1 on IIS 5 W2K

Thanks

-josh





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




Re: [PHP] Re: sorting a list using regex

2002-06-05 Thread Miguel Cruz

I completely don't understand what you're trying to say, but I have a 
sneaking suspicion the usort() functions might be helpful here.

miguel

On Wed, 5 Jun 2002, Joshua E Minnie wrote:
 I am trying to sort a list by their first character, my problem comes when
 that first character is a number.  When the character is a number I should
 be able to display just the values which begin with a number.  When the
 value is a letter, I have no problem sorting this out.  Here is the code
 that I am using to determine that, any help will be greatly appreciated.
 
 ?
 [snip]
 while(!feof($fp)) {
   $artist = fgetcsv($fp,1024,:);
   if(isset($_GET[sort])) {
 if(($_GET[sort] != substr(strtoupper($artist[0]),0,1)) 
 !($_GET[sort] == #  ereg(^[0-9],$artist[0]))) continue;
   }
 }
 [snip]
 ?
 
 Running PHP 4.2.1 on IIS 5 W2K
 
 Thanks
 
 -josh
 
 
 
 
 
 


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