Hi.
In the application i am working i need to fetch data from various sources like(facebook,twitter and 2 of my application database tables and join all the informatiion together (in an array).
What i am doing right now is to fetch all the data from the different sources as an array and them create a new array with all the fields needed from various sources.
After that, i might need to do operations like sorting the array by various fields. (some of them relatively complex).
The problem is with the constant growing of data my application will probably became pretty slow with so many array operations.
Because the data coming from many different sources it´s almost impossible to page,
I could limit the data coming from the initial arrays (by date for example) but i need a way to make some paging in the client side.
My code is something like this (pseudocode);
$postsFacebook = getFacebookPosts();
$postsMyApp = getMyApplicationPosts();
if(!empty($postsFacebook)){
foreach($postsFacebook as $key => $value){
// create array with needed fields
}
if(!empty($postsMyApp )){
foreach($postsMyApp as $key => $value){
// append to previous created array
}
uasort($finalArray,array($this, "complexSortMethod"));
Then for paging i am using array_slice.
How can i improve my code?