note 104285 deleted from function.str-replace by danbrown

From: Date: Mon, 06 Jun 2011 02:36:25 +0000
Subject: note 104285 deleted from function.str-replace by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-180291@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- About quotation mark conversion (from curly to vertical), for me works the code of http://www.toao.net/48-replacing-smart-quotes-and-em-dashes-in-mysql I have enough with the first half. With a function it can be: <?php function doitwell($text) { $badwordchars=array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"); $fixedwordchars=array("'", "'", '"', '"', '-', '--', '...'); return str_replace($badwordchars,$fixedwordchars,$text); } $tryitnow = doitwell("sdsd “sdsdsdfdfssd” fdsds"); echo $tryitnow; ?>

« previous php.notes (#180291) next »