- preg_split: documentation ( source)
- join: documentation ( source)
<?php
$str = "ˈdɪk ʃəˌnɛr i";
$chrArray = preg_split('//u', $str, -1, PREG_SPLIT_NO_EMPTY);
for($i = 0 ; $i < count($chrArray) ; $i++) {
if($chrArray[$i] == 'ˈ' || $chrArray[$i] == 'ˌ') $chrArray[$i] = '_';
}
$output = join($chrArray, "");
echo $output;