note 104285 added to function.str-replace

From: Date: Mon, 06 Jun 2011 00:32:15 +0000
Subject: note 104285 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-180290@lists.php.net to get a copy of this message
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; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 85.54.169.84 ---- Manual Page -- http://www.php.net/manual/en/function.str-replace.php Edit -- https://master.php.net/note/edit/104285 Del: integrated -- https://master.php.net/note/delete/104285/integrated Del: useless -- https://master.php.net/note/delete/104285/useless Del: bad code -- https://master.php.net/note/delete/104285/bad+code Del: spam -- https://master.php.net/note/delete/104285/spam Del: non-english -- https://master.php.net/note/delete/104285/non-english Del: in docs -- https://master.php.net/note/delete/104285/in+docs Del: other reasons-- https://master.php.net/note/delete/104285 Reject -- https://master.php.net/note/reject/104285 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180290) next »