これはあなたを正しい方向に向けるかもしれません..テストしていませんが、始めるには十分なはずです. 非常にシンプルなコンセプト。フィート + インチの弦から始めました。これで、メートルをそこに入れる方法を理解できるはずです。
// $startHeight and $endHeight are in inches
function createRange($startHeight,$endHeight){
// calculate the difference in inches between the heights
$difference = $endHeight - $startHeight;
// create an array to put the results in
$resultsArray;
//create a loop with iterations = $difference
for($i=0;$i<$difference;$i++)
{
// create the current height based on the iteration
$currentHeight = $startHeight + $i;
// convert the $currentHeight to feet+inches
// first find the remainder, which will be the inches
$remainder = ($currentHeight % 12);
$numberOfFeet = ($currentHeight - $remainder)/12;
// build the feet string
$feetString = $numberOfFeet.'''.$remainder.'"';
// now build the meter string using a similar method as above
// and append it to $feetString, using a conversion factor
// add the string to the array
$resultsArray[] = $feetString;
}
// return the array
return $resultsArray;
}