note 68641 added to function.strip-tags

From: Date: Fri, 04 Aug 2006 15:24:21 +0000
Subject: note 68641 added to function.strip-tags
Groups: php.notes 
Request: Send a blank email to php-notes+get-115551@lists.php.net to get a copy of this message
I think that new function works. function theRealStripTags2($string) { $tam=strlen($string); // tam have number of cars the string $newstring=""; // newstring will be returned $tag=0; /* tag = 0 => copy car from string to newstring tag > 0 => don't copy. Find one or mor tag '<' and need to find '>'. If we find 3 '<' need to find all 3 '>' */ /* I am C programm. seek in a string is natural for me and more efficient Problem: copy a string to another string is more efficient but use more memory!!! */ for ($i=0; $i < $tam; $i++){ /* If I find one '<', $tag++ and continue whithout copy*/ if ($string{$i} == '<'){ $tag++; continue; } /* if I find '>', decrease $tag and continue */ if ($string{$i} == '>'){ if ($tag){ $tag--; } /* $tag never be negative. If string is "<b>test</b>>" (error, of course) $tag stop in 0 */ continue; } /* if $tag is 0, can copy */ if ($tag == 0){ $newstring .= $string{$i}; // simple copy, only car } } return $newstring; } ---- Server IP: 66.163.161.117 Probable Submitter: 201.11.200.27 ---- 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.strip-tags.php Edit -- https://master.php.net/note/edit/68641 Del: integrated -- https://master.php.net/note/delete/68641/integrated Del: useless -- https://master.php.net/note/delete/68641/useless Del: bad code -- https://master.php.net/note/delete/68641/bad+code Del: spam -- https://master.php.net/note/delete/68641/spam Del: non-english -- https://master.php.net/note/delete/68641/non-english Del: in docs -- https://master.php.net/note/delete/68641/in+docs Del: other reasons-- https://master.php.net/note/delete/68641 Reject -- https://master.php.net/note/reject/68641 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#115551) next »