Thanks for the great input
I think it might be a stack overflow, since the topics array has about 1000 entry nested as categories and sub-categories..
This nesting forced me to think of using recursion to combact the code .. because I need to show the topics herarichally..
I tried to ( simulate ) the recursion process using stacks .. and thankfully I succeeded ..
I just want to say something I just found out,
IT IS VERY BAD TO ASSIGN GLOBAL VARIABLES IN FUNCTIONS FOR LARGE ARRAYS.
Yes it is really bad..
Try to make it local as much as possible..
When I put the array as global variable: The script ran in almost 4 sec
But as a local variable it never exceeded two seconds..
I believe this also justifies the reason why XML parsing is very slow for ( LARGE ) xml files in php .. it will definitely be very slow if you were using global array variables in the functions (opening tag, closing tag, cdata handler) .. I can't think of a solution for the XML thing right now .. but the original problem of this thread was resolved..
Thanks.