note 62671 added to function.strtolower

From: Date: Tue, 07 Mar 2006 00:53:02 +0000
Subject: note 62671 added to function.strtolower
Groups: php.notes 
Request: Send a blank email to php-notes+get-104948@lists.php.net to get a copy of this message
If you ever need to strtolower a string with href tags on it and doesn't want to mess with the characters inside a tag, this is for you. <?php function loweroutsidetags ($str) { $chars = preg_split ("//", $str); $tolower = true; $str = ''; foreach ($chars as $k) { if ($k == '<') { $tolower = false; } if ($tolower) { $k = strtolower ($k); } $str .= $k; if ($k == '>') { $tolower = true; } } return $str; } ?> this: echo loweroutsidetags('aALalala <a href="?q=CASEsENSITIVINESSinURLSareSTUPID">') will give: aalalala <a href="?q=CASEsENSITIVINESSinURLSareSTUPID"> ---- Server IP: 200.185.109.103 Probable Submitter: 200.196.241.1 ---- X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.strtolower.php Edit -- http://master.php.net/note/edit/62671 Del: integrated -- http://master.php.net/note/delete/62671/integrated Del: useless -- http://master.php.net/note/delete/62671/useless Del: bad code -- http://master.php.net/note/delete/62671/bad+code Del: spam -- http://master.php.net/note/delete/62671/spam Del: non-english -- http://master.php.net/note/delete/62671/non-english Del: in docs -- http://master.php.net/note/delete/62671/in+docs Del: other reasons-- http://master.php.net/note/delete/62671 Reject -- http://master.php.net/note/reject/62671 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104948) next »