模式工作正常,但我希望它们采用一种正则表达式模式:
$reg_data['phone'] = preg_replace('/[\s\(\)]+/', '', $reg_data['phone']);
$reg_data['phone'] = preg_replace('/^\+998/', '', $reg_data['phone']);
答案 0 :(得分:2)
$reg_data['phone'] = preg_replace('~[\s\(\)]+|^\+998~', '', $reg_data['phone']);