<?php $regex = '#\+?\(?\d+\)?\s?\d+\s?\d+#'; $x = [ '+370 655 54298', '+37065782505', '37069788505', '865782825', 'hjtgfjtdfjtgdfjt', '65782825', '(686) 51852', ]; foreach ($x as $y) { if (preg_match($regex, $y, $match)) { echo $match[0] . "\n"; } }
You have javascript disabled. You will not be able to edit any code.