Codice PHP:
function getDigitCount($str) {
    
preg_match_all('/[0-9]+/'$str$occurrence);
    
$count 0;
    foreach (
$occurrence[0] as $value) {
        
$count += strlen($value);
    }
    return 
$count;