出于某种奇怪的原因,下面的函数11
在 input 时返回2
,我希望它返回1
。怎么了?
<?php
function convert($v){
$arr = array(
2 => 1,
21 => 1,
3 => 2,
6 => 2,
11 => 2,
12 => 2,
4 => 3,
14 => 3,
19 => 3,
9 => 5,
1 => 11,
10 => 11,
22 => 12,
23 => 13,
14 => 14,
);
$ret = str_replace(array_keys($arr), array_values($arr), $v);
return $ret;
}
echo convert(2); // echoes 11
?>