Calculate sum of ascii values of email address in php -
i want echo sum of lowercase ascii values of email address. example:
a@b.nl
97(a) + 64(@) + 98(b) + 46(.) + 110(n) + 108(l) = 523
any idea how calculate in php?
try use ord() in php:
ord()
example
$str = "a@b.nl"; $sum = 0; $arr1 = str_split($str); foreach($arr1 $item){ $sum += ord($item); }
Comments
Post a Comment