| 
	
 | 
 Posted by ImOk on 06/20/06 16:17 
Lets say I have an array of names, gender, age and salary that I read 
from an Excel spreadsheet or CSV file. 
 
How do I sort this by gender+salary+age and get a subset of anyone over 
40 possibly ascending or descending? 
 
E.g. 
$arr[0]=array('M',20000,20,'JOHN'); 
$arr[1]=array('F',22000,24,'JANE'); 
$arr[2]=array('M',32000,40,'JOE'); 
 
I looked at using array_multisort but you have to jump through hoops it 
seems. Maybe I am doing this wrong. 
 
I am aware data will be lost of course when the program terminates. And 
it can always be saved to a text file. Sometimes small databases are 
much faster and easier being manipulated in memory especially if I dont 
have to install a database engine. 
 
Tim Martin wrote: 
> ImOk wrote: 
> > Anyone know of an extension that is an in memory database? 
> 
> I've never used it from PHP, but AIUI SQLite (www.sqlite.org) has a PHP 
> extension, and can be used to create an in-memory database. 
> 
> > I dont want to create any files on disk (nor install a database engine) 
> > but have an object/variable that points to a database and tables all in 
> > memory. 
> 
> Why do you want to do this? What problem are you trying to solve? You 
> are aware that all data may be lost at the end of the script execution? 
>  
> Tim
 
  
Navigation:
[Reply to this message] 
 |