Results 1 to 10 of 10
-
19th Jan 2011, 01:14 AM #1OPMember
str_replace help
PHP Code:$replace = array("&");
$str = str_replace($replace, "and", $str);
but whatever I try it does not seem to work out
PHP Code:$replace = array("what here?");
$str = str_replace($replace, "-", $str);
r0ck Reviewed by r0ck on . str_replace help $replace = array("&"); $str = str_replace($replace, "and", $str); Ok, so I figured the above out and its working great for me....however I would also like to replace the emdash with - but whatever I try it does not seem to work out $replace = array("what here?"); $str = str_replace($replace, "-", $str); Rating: 5
-
19th Jan 2011, 02:10 AM #2Respected Member
try one of these:
PHP Code:$replace = array(chr(151));
$str = str_replace($replace, "-", $str);
$replace = array('—');
$str = str_replace($replace, "-", $str);
-
19th Jan 2011, 02:54 AM #3OPMember
will try that I had those however was putting "" around them so may have been issue
-
19th Jan 2011, 07:33 AM #4Member
The $search array can contain more than one entries.
-
19th Jan 2011, 07:23 PM #5OPMember
dang still not working
-
19th Jan 2011, 08:08 PM #6Respected Member
Dump part of your file you are converting and post it so we can see the actual characters or attach a sample with the characters that do not convert.
-
19th Jan 2011, 08:13 PM #7MemberWebsite's:
Tastro.org HDTVXviDLOL.com EpisodeSeasons.com FileBorg.org W-47.comLE with your pr2 site? <a href="http://tastro.org/">Tastro.org</a> or link exchance with our category page: <a href="http://tastro.org/i/hdtv">HDTV</a> | <a href="http://tastro.org/i/dvdrip">DVDRip</a> | <a href="http://tastro.org/i/r5">R5</a> | <a href="http://tastro.org/i/bdrip">BDRip</a> | <a href="http://tastro.org/i/brrip">BRRip</a>
-
19th Jan 2011, 08:14 PM #8MemberWebsite's:
Tastro.org HDTVXviDLOL.com EpisodeSeasons.com FileBorg.org W-47.comjust replace — with - ?
or use preg_match to allow only the chars you want.LE with your pr2 site? <a href="http://tastro.org/">Tastro.org</a> or link exchance with our category page: <a href="http://tastro.org/i/hdtv">HDTV</a> | <a href="http://tastro.org/i/dvdrip">DVDRip</a> | <a href="http://tastro.org/i/r5">R5</a> | <a href="http://tastro.org/i/bdrip">BDRip</a> | <a href="http://tastro.org/i/brrip">BRRip</a>
-
19th Jan 2011, 08:29 PM #9Respected Member
try this:
2013 is en-dash and 2014 is em-dash
PHP Code:$str = str_replace("\x2014", "\x2D", $str);
$str = str_replace("\x2013", "\x2D", $str);
-
21st Jan 2011, 11:38 PM #10MemberWebsite's:
tehMoviez.com 0Senes.com GeekFaceGames.comtry this, hopeit works
PHP Code:$str = str_replace(utf8_decode("\xe2\x80\x94"), utf8_decode("\xe2\x80\x93"), $str);
JokerHacker Blog
JokerHacker PHP coding Service // back again!
CurlAxel PHP Download Accelerator
hardly remembering the milk :p
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
themaCreator - create posts from...
Version 3.47 released. Open older version (or...