$str = "135"; substr($str, 1, 1) = "234"; print $str; This should give you "12345";