如何检查一个整数是否在 PHP 中的数字范围内? [英] How to check if an integer is within a range of numbers in PHP?

查看:20
本文介绍了如何检查一个整数是否在 PHP 中的数字范围内?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查给定数字是否在数字范围内?

How can I check if a given number is within a range of numbers?

推荐答案

表达式:

 ($min <= $value) && ($value <= $max)

如果 $value 介于 $min$max 之间,则为真

will be true if $value is between $min and $max, inclusively

有关比较运算符的更多信息,请参阅 PHP 文档

See the PHP docs for more on comparison operators

这篇关于如何检查一个整数是否在 PHP 中的数字范围内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆