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

From: Date: Sat, 20 Nov 1999 13:15:07 +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-6571@lists.php.net to get a copy of this message
On Sat, 20 Nov 1999, Andi Gutmans wrote: > 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 yes - read the rest of my mail... it should do string -> string conversion tc > 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/ > > 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

« previous php.version4 (#6571) next »