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

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

For example, say:


How do I check if variable

6条回答
  •  温柔的废话
    2021-01-24 06:42

    You can use is_numeric to check if a var is a number. You also have is_int. To test if it's positive juste do something like if (var > 0).

提交回复
热议问题