note 68571 deleted from function.str-ireplace by danbrown

From: Date: Mon, 18 May 2009 14:54:23 +0000
Subject: note 68571 deleted from function.str-ireplace by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155686@lists.php.net to get a copy of this message
Note Submitter: hans111 ---- <?php if(!function_exists('str_ireplace')) { function str_ireplace($search, $replacement, $string){ $delimiters = array(1,2,3,4,5,6,7,8,14,15,16,17,18,19,20,21,22,23,24,25, 26,27,28,29,30,31,33,247,215,191,190,189,188,187,186, 185,184,183,182,180,177,176,175,174,173,172,171,169, 168,167,166,165,164,163,162,161,157,155,153,152,151, 150,149,148,147,146,145,144,143,141,139,137,136,135, 134,133,132,130,129,128,127,126,125,124,123,96,95,94, 63,62,61,60,59,58,47,46,45,44,38,37,36,35,34); foreach ($delimiters as $d) { if (strpos($string, chr($d))===false){ $delimiter = chr($d); break; } } if (!empty($delimiter)) { return preg_replace($delimiter.quotemeta($search).$delimiter.'i', $replacement, $string); } else { trigger_error('Homemade str_ireplace could not find a proper delimiter.', E_USER_ERROR); } } } ?>

« previous php.notes (#155686) next »