<?php
function test($str){
        $len = strlen($str);

        for ($i=0; $i < $len; $i += 2){
            $str[$i] = mb_strtoupper($str[$i], "utf-8");
        }
        echo $str;
    }
test("To be or not to be");
?>