127 ) { $return .= $debut . $lettre . $string{++$pos} . $fin; $correctionUTF8++; } else { $return .= $debut . $string{$pos} . $fin; } $lastpos = $pos+1; } $return .= substr($string, $lastpos, strlen($string)-$lastpos); } else { $return = $string; } return $return; } function run_test() { echo str_replacepos('abcd', array(0,1,3), '[', ']')."\n"; // [a][b]c[d] echo str_replacepos('abcd', array(1,3), '[', ']')."\n"; // a[b]c[d] echo str_replacepos('aécd', array(1,3), '[', ']')."\n"; // a[é]c[d] } ?>