note 58039 deleted from function.explode by bjori

From: Date: Mon, 25 Sep 2006 08:07:38 +0000
Subject: note 58039 deleted from function.explode by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117574@lists.php.net to get a copy of this message
Note Submitter: fsnirl.hinny at gmail.com ---- Correct me if I'm wrong, but I think this way of doing the explode_quote or explode2 function is much quicker if you always want to mark words by quotes and a space is the delimeter to break things on otherwise. Using php's built in functions usually makes things run a lot faster. <?php function explode_quotes($AString) { $words = wordwrap($AString,3); $exploded = explode("\n",$words); $exploded = str_replace(chr(26),' ',$exploded); return $exploded; } ?> I don't know what benchmark you are talking about for the other posts since they are never really described, but I just put a for loop around each one and ran the for loop 400000 times and here is the time difference between my explode_quotes and the first posted explode_quote Start 1: 1129947556 End 1: 1129947559 Total 1: 3 seconds Start 2: 1129947559 End 2: 1129947584 Total 2: 25 seconds Not very scientific, but the advantage is clear. Note, my email address is obfuscated by moving my left hand one key position to the right.

« previous php.notes (#117574) next »