I think there must have been a copy paste error, because this is the code I used exactly:
<?php
$string = <<<END
Hello my number is 07812345678 my friends number is 07787654321
Your number is 256987654321 and your friends number is 256123456789
END;
if( preg_match_all('/(256(\d{9})|07(1|7|8|9)(\d{8}))/',$string,$matches) ) {
echo 'Matches found!<br><pre>';
var_dump($matches);
echo '</pre>';
} else {
echo 'No matches found!';
}
And this is the output (only first offset (full numbers) not all offsets because it includes subpatterns that don't matter!
Matches found!
array
0 =>
array
0 => string '07812345678' (length=11)
1 => string '07787654321' (length=11)
2 => string '256987654321' (length=12)
3 => string '256123456789' (length=12)