Is it possible to perform SQL type processes on arrays. For example if I were to have a block of text and explode the words would it be possible to GROUP BY the word?
Perhaps there is a built in php function to do this? (hoping :))
Cheers
Birdman
9:36 am on Feb 11, 2003 (gmt 0)
Hi uk,
Maybe the sort function [php.net]. There were other variations of sort() also.
andreasfriedrich
11:28 am on Feb 11, 2003 (gmt 0)
Something like GROUP BY is usually done using a hash. You loop over the array and put the elements into a hash. If a certain key already exists do whatever you need to do, i.e. use whatever aggregate function you would use in SQL.
Andreas
jatar_k
2:29 pm on Feb 11, 2003 (gmt 0)
array_multisort() [php.net] works well for sorting multi dimensional arrays. The comments were helpful in understanding how it works.