tags:

views:

27

answers:

1

Hello :)

I have a height dropdown, but its missing '10, '11, '12, inches from the foot due to php going straight up a number once it hits .10, which it should.

I figured maybe an if statement around the values area that detects the decimal being .9 and then automatically adding .10, .11, .12. However I wondered if anyone had anything neater?

    public function load_heights() {
        $from   = 5;
        $to     = 7;
        $values = array();

        while ($from <= $to) {
            $values[''.$from.''] = $from.' "';
            $from += 0.1;
        }
        return $values;
    }
+3  A: 
$heights=array();

for ($i=5;$i<=7;$i++){
  for ($j=0;$j<=12;$j++){
    $heights[''.$i.'.'.$j.''] = $i.'\' '.$j.'\'\'';
  }
}

return $heights;

Proper height characters instead of ' needed

Adam Kiss
Very nice thanks
azz0r
You're welcome .
Adam Kiss