Check if variable is a number and positive integer in PHP?

后端 未结 6 1397
甜味超标
甜味超标 2021-01-24 06:11

For example, say:


How do I check if variable

6条回答
  •  北海茫月
    2021-01-24 06:48

    You can do it like this:-

    if( is_int( $_GET['id'] ) && $_GET['id'] > 0 ) {
    
       //your stuff here
    
    }
    

提交回复
热议问题