Activity Stream
48,167 MEMBERS
6845 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 10 of 10
  1.     
    #1
    Member

    Default str_replace help

    PHP Code: 
    $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

    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

  2.   Sponsored Links

  3.     
    #2
    Respected Member
    try one of these:
    PHP Code: 
    $replace = array(chr(151)); 
       
    $str str_replace($replace"-"$str); 
    $replace = array('—'); 
       
    $str str_replace($replace"-"$str); 

  4.     
    #3
    Member
    will try that I had those however was putting "" around them so may have been issue

  5.     
    #4
    Member
    The $search array can contain more than one entries.

  6.     
    #5
    Member
    dang still not working

  7.     
    #6
    Respected 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.

  8.     
    #7
    Member
    Website's:
    Tastro.org HDTVXviDLOL.com EpisodeSeasons.com FileBorg.org W-47.com
    Quote Originally Posted by Lock Down View Post
    try one of these:
    PHP Code: 
    $replace = array(chr(151)); 
       
    $str str_replace($replace"-"$str); 
    $replace = array('—'); 
       
    $str str_replace($replace"-"$str); 
    chr(151) isn't such a good idea... as UTF-8, ISO, etc. all doesn't have the same numbers for the same chars.
    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>

  9.     
    #8
    Member
    Website's:
    Tastro.org HDTVXviDLOL.com EpisodeSeasons.com FileBorg.org W-47.com
    just 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>

  10.     
    #9
    Respected 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); 

  11.     
    #10
    Member
    Website's:
    tehMoviez.com 0Senes.com GeekFaceGames.com
    try this, hopeit works

    PHP Code: 
     $str str_replace(utf8_decode("\xe2\x80\x94"), utf8_decode("\xe2\x80\x93"), $str); 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

BE SOCIAL