on 02 Dec 2003 18:56:28 -0500 Robert Cummings wrote:

RC> I missed the original post, and I'm too lazy to go looking, but the
RC> following code runs in approx. 2.75 seconds on my Athlon 2400 running
RC> linux:

it is 4.3 seconds on xp 1600+..

RC>     $chars = '0123456789'
RC>             .'abcdefghijklmnopqrstuvwxyz'
RC>             .'ABCDEFGHIJKLMNOPQRSTUVWXYZ';

RC>     $charArray = array();
                         
RC>     for( $i = 0; $i < 1000000; $i++ )
RC>     {                                
RC>         $charArray[] = $chars[rand( 0, 61 )];
RC>     }                                        

RC> It's runs much faster than using a .= style of string creation.

..and replacing "$charArray[] =" with "$s .=" crawls this down to 3.5
seconds - so this is faster here..

winxp, php 4.3.4, Apache 1.xx


-- 
shinE!
http://www.thequod.de ICQ#152282665
PGP 8.0 key: http://thequod.de/danielhahler.asc

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to