note 55954 added to function.str-replace

From: Date: Thu, 18 Aug 2005 22:32:52 +0000
Subject: note 55954 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-93855@lists.php.net to get a copy of this message
Just like you can use str_replace() for [url] and such tags, you can also use it for a code tag. <?php function replaceCODE($message) { // Makes a Special Section from [code][/code] $message = '.'.$message; if (strpos($message, '[code]')) { $begCODE = strpos($message, '[code]'); $endCODE = strpos($message, '[/code]'); $code = substr($message, $begCODE, $endCODE); $messagepart1 = substr($message, 0, $begCODE); $messagepart2 = substr($message, $endCODE +7, count(count_chars($message,1))); $code = replaceSPACES($code); $message = substr($messagepart1,1).$code.$messagepart2; // searches for other [code]-nodes $message = replaceCODE($message); } return $message; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.str-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55954 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55954&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55954&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55954&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55954&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55954&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55954&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55954&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93855) next »