Re: [PHP4BETA] suggestion for new function str_change(string str,array transtable [,bool reverse])

From: Date: Sat, 20 Nov 1999 11:16:19 +0000
Subject: Re: [PHP4BETA] suggestion for new function str_change(string str,array transtable [,bool reverse])
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-6565@lists.php.net to get a copy of this message
Do you want it to be able to substitute only one character strings or is it supposed to be general? For example taking your example do you want to allow: $trans = array("ue" => "ü","ss" => "ß"); // expand german umlauts Andi At 11:25 AM 11/20/99 +0100, Thies C. Arntzen wrote:
lets start with this - i don't like the name function should search/replace a number of pairs in str and return the new string. sample: $trans = array("ü" => "ue","ß" => "ss"); // expand german umlauts $data = str_change("üß",$trans); // $data will be "uess"; // 3th argumet changed the "direction" in the transtable $data = str_change($data,$trans,true); // $data will be "üß" again. this function will make it easy to eg reverse an htmlspecialchars(). we could also make the table used by htmlspecialchars() and htmlentites() accessible in transtable format: $tt = get_htmltable(ISO-8859-1); // returns "EntTable" from html.c $plaindata = str_change($htmlencodeddata,$tt,1); // reverse htmlentities does that make sense? (any better ideas?) tc
Thies C. Arntzen                 "One Big-Mac, Small Fries and a Coke!"
Digital Collections             Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93                              20097 Hamburg / Germany
-- PHP 4.0 Beta Mailing List <http://www.php.net/version4/> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net For additional commands, e-mail: php4beta-help@lists.php.net To contact the list administrators, e-mail: php4beta-admin@lists.php.net
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.version4 (#6565) next »