- 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])."</br>"; //Returns 1
echo "Array size: " . sizeof($matches[0])."</br>"; //Returns 1
print_r($matches);