我必须使用正则表达式检查变量(php,preg_match)是否来自1988年和2011年; 我知道如何使用普通的if/else来做,但我想使用正则表达式!
有时,正则表达式不是唯一的答案:
if( preg_match('/^\d{4}$/', $input) && $input>=1988 && $input<=2011 ){
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2420 次 |
| 最近记录: |