Somebody somewhere sometime somehow wants this algorithm [translation: I'm too tired to remember]

(please note: algorithm - no letter y; non-rhythmic in all ways)

PHP Code:
// returns number of replacements, -1 for error
int replacech(char *tunsigned char oldunsigned char new){
             
char *buf;
             
int i=0;
             if(
t==NULL || old || new < 1) return (-1);
             while (
strchr(t,old) != NULL){
                      
buf strchr(t,old);
                      *
buf = new;
                      
i++;
             }
             return 
i;