/**
 * @param String $s
 * @param String $t
 * @return String
 */
function findTheDifference($s, $t) {
    $len_s = strlen($s);
    $sum_s = 0;
    $sum_t = 0;
    $i = 0;
    // calculate sum of strings by ascii codes numbers
    for(; $i < $len_s; $i++){
        $sum_s += ord($s[$i]);
        $sum_t += ord($t[$i]);
    }
    // so $len_s + 1 == $t 
    // length thats why
    $sum_t += ord($t[$i]);
    return chr($sum_t - $sum_s);
}
by Vasil Grdzelishvili
2 years ago
PHP
leetcode
0
Pro tip: use ```triple backticks around text``` to write in code fences