- strpos: documentation ( source)
- ord: documentation ( source)
<?php
/**
* Sum byte values from position x in $str
**/
function sum( $str, $x )
{
$sum = 0;
for ( $max = strlen( $str );
$x < $max;
++$x )
{
$sum += ord( $str[ $x ] );
}
return $sum;
}
$str = 'Hello, Dolly';
echo sum($str, strpos( $str, 'D')); //