Iata un script simplu care extrage numere de telefon de forma 0222112233 dintr-un text:
<?php
function extract_tel_from($string){
preg_match_all("#(\d{10})#", $string, $matches);
return $matches[0];
}
if(isset($_POST['telefoane'])) {
$tel = extract_tel_from($_POST['telefoane']);
echo "<b>Telefoane</b></br> ";
print(implode("<br/>", $tel));
}
?>
</b>
<b>Telefoane</b>
<form method="post">
<textarea name="telefoane"></textarea>
<input type="submit" />
</form>