So finden Sie die Zahl zwischen verschiedenen Bereichen in PHP
// how to find number between different ranges in php
$number = 143;
$ranges = [
"range1" => [
"from" => 0,
"to" => 23
],
"range2" => [
"from" => 24,
"to" => 47
],
"range3" => [
"from" => 49,
"to" => 143
],
"range4" => [
"from" => 144,
"to" => 876000
],
];
foreach ($ranges as $key => $range) {
if ( in_array($number, range($range['from'], $range['to']))) {
return $key;
}
}
Copy Paster