note 44877 deleted from function.str-ireplace by tomsommer

From: Date: Wed, 18 Aug 2004 19:30:06 +0000
Subject: note 44877 deleted from function.str-ireplace by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-74902@lists.php.net to get a copy of this message
Note Submitter: theblasp at gmail dot com ---- Because I needed this function on a PHP4 box, I wrote it myself using strpos. Feel free to use it, or suggest improvements :) <?php function my_str_ireplace($from,$to,$msg) { $offset=0; $res=""; $lmsg=strtolower($msg); while ($found=strpos($lmsg,$from,$offset)) { $res.=substr($msg,$offset,$found-$offset); $res.=$to; $offset=$found + strlen($from); } $res.=substr($msg,$offset); return $res; } ?>

« previous php.notes (#74902) next »