note 43006 deleted from function.str-ireplace by aidan

From: Date: Mon, 05 Jul 2004 17:29:57 +0000
Subject: note 43006 deleted from function.str-ireplace by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72619@lists.php.net to get a copy of this message
Note Submitter: kire at gamedesign dot be ---- After some tests i noticed that str_ireplace isn't always faster as preg_replace with the i-modifier. str_ireplace when the needle appears in the result in lower letters (so "test" will be replaced faster as "TEST"). Doing the same test with a string which contained only capital letters was almost 7-8x slower then a string which contained only lowercase letters. preg_replace however didn't have any problems with capital letters and kept the same speed. Also the length of needle seemed to have an influence on the speed of str_ireplace, but this difference isn't that spectacular, but again it seems to be slower when the needle is longer. However this tests were done with PHP5 RC2 (on IIS) and str_ireplace probably wasn't fully optimized, str_ireplace was only faster on a string with lowercase letters AND with a short needle.

« previous php.notes (#72619) next »