使用php函数允许用户从下拉列表中选择他们的dob [关闭]

I saw from online somewhere a method to let user select their DOB using a Drop down list using php function. This is a selection of it:

<select name="monthOfBirth">
<option value="">---Select month---</option>
<?php for ($i = 1; $i <= 12; $i++) : ?>
<option value="<?php echo ($i < 10) ? '0'.$i : $i; ?>"><?php echo $i; ?></option>
<?php endfor; ?>
</select>

I tried it and it works, but can anybody explain to me what this does:

<option value="<?php echo ($i < 10) ? '0'.$i : $i; ?>"><?php echo $i; ?></option>

I know it will list down the date but I do not understand the ..?'0'.$i ; $i;.. part. Can anybody explain to me?

It is a short if/else:

// This
echo ($i <10) ? '0'.$i : $i;
// Is the same as this:
if( $i <10){ echo '0'.$i;}
else{        echo $i;}

It adds a zero if less than 10.

You could do this too:

if( $i <10){ echo '0';}
echo $i;

Edit: You wrote $1 instead of $i in your code, and got a > where a < was needed