replace from ’ to '

Discussion in 'PHP' started by trichnosis, Jul 29, 2007.

  1. #1
    Hi;

    I have a bit strange problem.

    
          function replace_tr($text) {
          $text = trim($text);
          $search = array('Ç','ç','Ğ','ğ','ı','İ','Ö','ö','Ş','ş','Ü','ü',' ');
          $replace = array('C','c','G','g','i','I','O','o','S','s','U','u','-');
          $new_text = str_replace($search,$replace,$text);
          return $new_text;
          }
    
          $string = 'Gürkan Arabacı';
          $new_string = replace_tr($string);
          echo $new_string;
    
    
    Code (markup):
    is a basic php replace sample but i want to replace ’ character with ' chracter.


    Can anybody help me for this?

    Thanks for the comments
     
    trichnosis, Jul 29, 2007 IP
  2. Vangs

    Vangs Peon

    Messages:
    8
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This will do it:

    $search = array('Ç','ç','G','g','i','I','Ö','ö','S','s','Ü','ü',' ','’');
    $replace = array('C','c','G','g','i','I','O','o','S','s','U','u','-','\'');
    PHP:
     
    Vangs, Jul 29, 2007 IP