Consider this array:
$yrs = array(2015,2014,2015,2013,2015,2014);
I need to display only the unique value inside a combo box.
I tried:
print_r(array_unique($yrs));
But it displays it like this:
Array ( [0] => 2015 [1] => 2014 [3] => 2013 )
I need to have only 2015, 2014, 2013 inside the combo box. How can i extract only these values?
My code:
<?php
$yrs = array(2015,2014,2015,2013,2015,2014);
?>
<select name="yrs">
<?php
echo "<option>";
echo implode(",",array_unique($yrs)); //here it displays in same option
echo "</option>";
?>
</select>
I need to get 2015 2014 2013 each in different options.