function char_to_uppercase(&$s, $idx) {
if ($idx < 0 || $idx > strlen($s)) {
return;
}
for ($i = 0; $i < strlen($s); $i++) {
if ($i == $idx) {
$s[$i] = strtoupper($s[$i]);
}
}
}
$s = "php programming";
char_to_uppercase($s, 0);
echo $s . "<br />";
char_to_uppercase($s, 5);
echo $s;
/*
run:
Php programming
Php pRogramming
*/