Scott Fletcher <mailto:[EMAIL PROTECTED]> on Wednesday, November 19, 2003 1:12 PM said:
> function CBC_XML_BreakUp(&$strResponse_XML, &$strResponse_HTML) > > { [snip] Wow I didn't think you were going to post your whole program. :0 1. Are you sure the for() loop is the slow part? 2. As someone already suggested, calculating the sizeof() outside of the loop should help a lot. Another enhancement is changing your for() to while(). (This is a small enhancement but makes a bigger difference as your iterations increase.) REGULAR for() loop construct: $iMax = 99; for($iCnt = 0; $iCnt < $iMax; $iCnt++) { } OPTIMIZED: $iMax = 99; $iCnt = -1; while(++$iCnt < $iMax) { } Like I said it's only slightly faster, but might make a difference depending on your number of iterations. 3. I think what may be slowing you down is your substr() calls. Maybe there is a substitute function that is faster? (I don't have any ideas unfortunately.) Let us know if you figure something out. HTH, Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php