Codice PHP:
$stringa "123456789";
$numeri preg_split('//'$stringa, -1PREG_SPLIT_NO_EMPTY);
$tot 0;
foreach(
$numeri as $numero)
    
$tot+=$numero;
echo 
$tot