我正在开发一个测试,它会给出 2 个值的结果
$result = array( 't' => 10, 's' => 20 );
并且我有范围将作为徽章名称从数组到该结果给出响应:
$badges = array(
'badge1' => array(
array('tLow' => 0, 'tHigh' => 20),
array('sLow' => 0, 'sHigh' => 10)
),
'badge2' => array(
array('tLow' => 0, 'tHigh' => 10),
array('sLow' => 11, 'sHigh' => 20)
),
'badge3' => array(
array('tLow' => 21, 'tHigh' => 30),
array('sLow' => 0, 'sHigh' => 10)
),
'badge4' => array(
array('tLow' => 31, 'tHigh' => 40),
array('sLow' => 0, 'sHigh' => 10)
),
'badge5' => array(
array('tLow' => 11, 'tHigh' => 30),
array('sLow' => 11, 'sHigh' => 30)
),
'badge6' => array(
array('tLow' => 0, 'tHigh' => 10),
array('sLow' => 21, 'sHigh' => 30)
),
'badge7' => array(
array('tLow' => 0, 'tHigh' => 10),
array('sLow' => 31, 'sHigh' => 40)
),
);
徽章数组对应于一个看起来像这样的网格
+---+
| 7 |
+---+---+---+
| 6 | |
+---+ 5 +
| 2 | |
+---+---+---+---+
| 1 | 3 | 4 |
+---+---+---+---+
所以我的问题是为我的结果获得徽章的最有效方法是什么?也许有更好的方法来解决这个问题?