- var_dump: documentation ( source)
- preg_match: documentation ( source)
- print_r: documentation ( source)
<?php
$data = [];
$data['phone'] = '2514017257';
$matches = [];
preg_match("/\+1\d{10}/", $data['phone'], $matches);
var_dump(preg_match("/\+1\d{10}/", $data['phone']));
print_r($matches);
$data['phone'] = '+12514017257';
$matches = [];
preg_match("/\+1\d{10}/", $data['phone'], $matches);
print_r($matches);