Convert national chars into their latin equivalents in PHP

后端 未结 7 1983
日久生厌
日久生厌 2021-01-01 22:27

I need some strings that contain german chars converted to their latin equivalent. For example

\'Höhle\' => \'Hohle\'
7条回答
  •  隐瞒了意图╮
    2021-01-01 23:07

    If it were me, I'd do something like this...

    $map = array(   'ö' => 'o',
                    // etc, etc, etc );
    
    foreach( $map as $orig => $new )
    {
       $myString = str_replace( $orig, $new, $myString );
    }
    

提交回复
热议问题