- array_sum: documentation ( source)
- print_r: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$string = "9hsfgh563452";
preg_match_all("/[0-9]/",$string,$matches);
echo "Array size: " . count($matches[0])."\n";
echo "Array size: " . sizeof($matches[0])."\n";
echo "Array sum: " . array_sum($matches[0])."\n";
print_r($matches[0]);